Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: re-use the bevy default font data #98

Merged
merged 2 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.