Skip to content

Commit

Permalink
feat: re-use the bevy default font data (#98)
Browse files Browse the repository at this point in the history
Closes #96
  • Loading branch information
simbleau authored Feb 4, 2025
1 parent ae710fe commit 1067eaf
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 100 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ This release supports Bevy version 0.14 and has an [MSRV][] of 1.80.
### Changed

- bevy_vello now uses Bevy 0.15
- The license on bevy_vello no longer includes OFL 1.1

### Fixed

- We no longer bundle the default font twice when the `default_font` feature is active.

## [0.6.1] - 2024-08-14

Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ members = [
[workspace.package]
edition = "2021"
version = "0.6.1"
license = "(MIT OR Apache-2.0) AND OFL-1.1"
license = "MIT OR Apache-2.0"
repository = "https://github.com/linebender/bevy_vello"

[workspace.dependencies]
Expand Down Expand Up @@ -68,4 +68,4 @@ default = ["default_font"]
svg = []
lottie = []
experimental-dotLottie = ["lottie"]
default_font = []
default_font = ["bevy/default_font"]
18 changes: 11 additions & 7 deletions src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
text::VelloFontLoader,
VelloAsset, VelloFont, VelloRenderSettings,
};
use bevy::{asset::load_internal_binary_asset, prelude::*, render::view::RenderLayers};
use bevy::{prelude::*, render::view::RenderLayers};
use vello::AaConfig;

#[derive(Clone)]
Expand Down Expand Up @@ -53,11 +53,15 @@ impl Plugin for VelloPlugin {
#[cfg(feature = "experimental-dotLottie")]
app.add_plugins(crate::integrations::dot_lottie::DotLottieIntegrationPlugin);
#[cfg(feature = "default_font")]
load_internal_binary_asset!(
app,
Handle::default(),
"text/FiraMono/FiraMono-subset.ttf",
|bytes: &[u8], _path: String| { VelloFont::new(bytes.to_vec()) }
);
{
let mut fonts = app
.world_mut()
.get_resource_mut::<Assets<VelloFont>>()
.unwrap();
fonts.insert(
Handle::default().id(),
VelloFont::new(bevy::text::DEFAULT_FONT_DATA.to_vec()),
);
}
}
}
Binary file removed src/text/FiraMono/FiraMono-subset.ttf
Binary file not shown.
91 changes: 0 additions & 91 deletions src/text/FiraMono/LICENSE

This file was deleted.

0 comments on commit 1067eaf

Please sign in to comment.