diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml index a79f65da4fa..7a9a94bcc73 100644 --- a/.github/workflows/labels.yml +++ b/.github/workflows/labels.yml @@ -29,4 +29,4 @@ jobs: with: mode: minimum count: 1 - labels: "CI, dependencies, docs and examples, ecolor, eframe, egui_extras, egui_glow, egui-wgpu, egui-winit, egui, epaint, exclude from changelog, typo" + labels: "CI, dependencies, docs and examples, ecolor, eframe, egui_extras, egui_glow, egui-wgpu, egui-winit, egui, epaint, epaint_default_fonts, exclude from changelog, typo" diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 81229ec0519..cf2c2d60a31 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -5,7 +5,7 @@ Also see [`CONTRIBUTING.md`](CONTRIBUTING.md) for what to do before opening a PR ## Crate overview -The crates in this repository are: `egui, emath, epaint, egui_extras, egui-winit, egui_glow, egui_demo_lib, egui_demo_app`. +The crates in this repository are: `egui, emath, epaint, epaint_default_fonts, egui_extras, egui-winit, egui_glow, egui_demo_lib, egui_demo_app`. ### `egui`: The main GUI library. Example code: `if ui.button("Click me").clicked() { … }` @@ -19,7 +19,12 @@ Examples: `Vec2, Pos2, Rect, lerp, remap` Example: `Shape::Circle { center, radius, fill, stroke }` -Depends on `emath`. +Depends on `emath`. Also depends on `epaint_default_fonts` when the `default_fonts` feature is enabled. + +### `epaint_default_fonts` +Embedded fonts (using `include_bytes!()`) for use by `epaint` in selecting defaults. + +Since the font files themselves are licensed differently from the `epaint` source code, this simplifies licenses for callers who disable the default fonts. ### `egui_extras` This adds additional features on top of `egui`. diff --git a/Cargo.lock b/Cargo.lock index d47e187e9ec..c4a6affbfad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1444,6 +1444,7 @@ dependencies = [ "document-features", "ecolor", "emath", + "epaint_default_fonts", "log", "nohash-hasher", "parking_lot", @@ -1452,6 +1453,10 @@ dependencies = [ "serde", ] +[[package]] +name = "epaint_default_fonts" +version = "0.28.1" + [[package]] name = "equivalent" version = "1.0.1" diff --git a/Cargo.toml b/Cargo.toml index f6b45737cd3..fd9690c603c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ members = [ "crates/egui", "crates/emath", "crates/epaint", + "crates/epaint_default_fonts", "examples/*", "tests/*", @@ -56,6 +57,7 @@ opt-level = 2 emath = { version = "0.28.1", path = "crates/emath", default-features = false } ecolor = { version = "0.28.1", path = "crates/ecolor", default-features = false } epaint = { version = "0.28.1", path = "crates/epaint", default-features = false } +epaint_default_fonts = { version = "0.28.1", path = "crates/epaint_default_fonts" } egui = { version = "0.28.1", path = "crates/egui", default-features = false } egui-winit = { version = "0.28.1", path = "crates/egui-winit", default-features = false } egui_extras = { version = "0.28.1", path = "crates/egui_extras", default-features = false } diff --git a/RELEASES.md b/RELEASES.md index 055de76ceb6..b825eef8df5 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -73,16 +73,17 @@ I usually do this all on the `master` branch, but doing it in a release branch i ### `cargo publish`: ``` -(cd crates/emath && cargo publish --quiet) && echo "✅ emath" -(cd crates/ecolor && cargo publish --quiet) && echo "✅ ecolor" -(cd crates/epaint && cargo publish --quiet) && echo "✅ epaint" -(cd crates/egui && cargo publish --quiet) && echo "✅ egui" -(cd crates/egui-winit && cargo publish --quiet) && echo "✅ egui-winit" -(cd crates/egui_extras && cargo publish --quiet) && echo "✅ egui_extras" -(cd crates/egui-wgpu && cargo publish --quiet) && echo "✅ egui-wgpu" -(cd crates/egui_demo_lib && cargo publish --quiet) && echo "✅ egui_demo_lib" -(cd crates/egui_glow && cargo publish --quiet) && echo "✅ egui_glow" -(cd crates/eframe && cargo publish --quiet) && echo "✅ eframe" +(cd crates/emath && cargo publish --quiet) && echo "✅ emath" +(cd crates/ecolor && cargo publish --quiet) && echo "✅ ecolor" +(cd crates/epaint && cargo publish --quiet) && echo "✅ epaint" +(cd crates/epaint_default_fonts && cargo publish --quiet) && echo "✅ epaint_default_fonts" +(cd crates/egui && cargo publish --quiet) && echo "✅ egui" +(cd crates/egui-winit && cargo publish --quiet) && echo "✅ egui-winit" +(cd crates/egui_extras && cargo publish --quiet) && echo "✅ egui_extras" +(cd crates/egui-wgpu && cargo publish --quiet) && echo "✅ egui-wgpu" +(cd crates/egui_demo_lib && cargo publish --quiet) && echo "✅ egui_demo_lib" +(cd crates/egui_glow && cargo publish --quiet) && echo "✅ egui_glow" +(cd crates/eframe && cargo publish --quiet) && echo "✅ eframe" ``` ## Announcements diff --git a/crates/epaint/Cargo.toml b/crates/epaint/Cargo.toml index 3588a280dc1..88ed8eb4220 100644 --- a/crates/epaint/Cargo.toml +++ b/crates/epaint/Cargo.toml @@ -6,7 +6,7 @@ description = "Minimal 2D graphics library for GUI work" edition.workspace = true rust-version.workspace = true homepage = "https://github.com/emilk/egui/tree/master/crates/epaint" -license = "(MIT OR Apache-2.0) AND OFL-1.1 AND LicenseRef-UFL-1.0" # OFL and UFL used by default_fonts. See https://github.com/emilk/egui/issues/2321 +license = "MIT OR Apache-2.0" readme = "README.md" repository = "https://github.com/emilk/egui/tree/master/crates/epaint" categories = ["graphics", "gui"] @@ -15,11 +15,7 @@ include = [ "../LICENSE-APACHE", "../LICENSE-MIT", "**/*.rs", - "Cargo.toml", - "fonts/*.ttf", - "fonts/*.txt", - "fonts/OFL.txt", - "fonts/UFL.txt", + "Cargo.toml" ] [lints] @@ -50,7 +46,7 @@ deadlock_detection = ["dep:backtrace"] ## If set, epaint will use `include_bytes!` to bundle some fonts. ## If you plan on specifying your own fonts you may disable this feature. -default_fonts = [] +default_fonts = ["epaint_default_fonts"] ## Turn on the `log` feature, that makes egui log some errors using the [`log`](https://docs.rs/log) crate. log = ["dep:log"] @@ -96,6 +92,8 @@ rayon = { version = "1.7", optional = true } ## Allow serialization using [`serde`](https://docs.rs/serde) . serde = { workspace = true, optional = true, features = ["derive", "rc"] } +epaint_default_fonts = { workspace = true, optional = true } + # native: [target.'cfg(not(target_arch = "wasm32"))'.dependencies] backtrace = { workspace = true, optional = true } diff --git a/crates/epaint/src/text/fonts.rs b/crates/epaint/src/text/fonts.rs index 394b898291e..7f8cea7f27b 100644 --- a/crates/epaint/src/text/fonts.rs +++ b/crates/epaint/src/text/fonts.rs @@ -10,6 +10,9 @@ use crate::{ }; use emath::{NumExt as _, OrderedFloat}; +#[cfg(feature = "default_fonts")] +use epaint_default_fonts::{EMOJI_ICON, HACK_REGULAR, NOTO_EMOJI_REGULAR, UBUNTU_LIGHT}; + // ---------------------------------------------------------------------------- /// How to select a sized font. @@ -217,7 +220,7 @@ fn ab_glyph_font_from_font_data(name: &str, data: &FontData) -> ab_glyph::FontAr /// /// // Install my own font (maybe supporting non-latin characters): /// fonts.font_data.insert("my_font".to_owned(), -/// FontData::from_static(include_bytes!("../../fonts/Ubuntu-Light.ttf"))); // .ttf and .otf supported +/// FontData::from_static(include_bytes!("../../../epaint_default_fonts/fonts/Ubuntu-Light.ttf"))); // .ttf and .otf supported /// /// // Put my font first (highest priority): /// fonts.families.get_mut(&FontFamily::Proportional).unwrap() @@ -263,39 +266,32 @@ impl Default for FontDefinitions { let mut families = BTreeMap::new(); - font_data.insert( - "Hack".to_owned(), - FontData::from_static(include_bytes!("../../fonts/Hack-Regular.ttf")), - ); + font_data.insert("Hack".to_owned(), FontData::from_static(HACK_REGULAR)); font_data.insert( "Ubuntu-Light".to_owned(), - FontData::from_static(include_bytes!("../../fonts/Ubuntu-Light.ttf")), + FontData::from_static(UBUNTU_LIGHT), ); // Some good looking emojis. Use as first priority: font_data.insert( "NotoEmoji-Regular".to_owned(), - FontData::from_static(include_bytes!("../../fonts/NotoEmoji-Regular.ttf")).tweak( - FontTweak { - scale: 0.81, // make it smaller - ..Default::default() - }, - ), + FontData::from_static(NOTO_EMOJI_REGULAR).tweak(FontTweak { + scale: 0.81, // make it smaller + ..Default::default() + }), ); // Bigger emojis, and more. : font_data.insert( "emoji-icon-font".to_owned(), - FontData::from_static(include_bytes!("../../fonts/emoji-icon-font.ttf")).tweak( - FontTweak { - scale: 0.88, // make it smaller - - // probably not correct, but this does make texts look better (#2724 for details) - y_offset_factor: 0.11, // move glyphs down to better align with common fonts - baseline_offset_factor: -0.11, // ...now the entire row is a bit down so shift it back - ..Default::default() - }, - ), + FontData::from_static(EMOJI_ICON).tweak(FontTweak { + scale: 0.88, // make it smaller + + // probably not correct, but this does make texts look better (#2724 for details) + y_offset_factor: 0.11, // move glyphs down to better align with common fonts + baseline_offset_factor: -0.11, // ...now the entire row is a bit down so shift it back + ..Default::default() + }), ); families.insert( diff --git a/crates/epaint_default_fonts/CHANGELOG.md b/crates/epaint_default_fonts/CHANGELOG.md new file mode 100644 index 00000000000..0b335fe25b5 --- /dev/null +++ b/crates/epaint_default_fonts/CHANGELOG.md @@ -0,0 +1,9 @@ +# `epaint_default_fonts` changelog +All notable changes to the `epaint_default_fonts` crate will be documented in this file. + +This file is updated upon each release. +Changes since the last release can be found at or by running the `scripts/generate_changelog.py` script. + + +## 0.28.1 - 2024-07-05 +Crate added. diff --git a/crates/epaint_default_fonts/Cargo.toml b/crates/epaint_default_fonts/Cargo.toml new file mode 100644 index 00000000000..9cb05fc0728 --- /dev/null +++ b/crates/epaint_default_fonts/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "epaint_default_fonts" +version.workspace = true +authors = ["Emil Ernerfeldt "] +description = "Default fonts for use in epaint / egui" +edition.workspace = true +rust-version.workspace = true +homepage = "https://github.com/emilk/egui/tree/master/crates/epaint_default_fonts" +license = "(MIT OR Apache-2.0) AND OFL-1.1 AND LicenseRef-UFL-1.0" # OFL and UFL are from the font files themselves. +readme = "README.md" +repository = "https://github.com/emilk/egui/tree/master/crates/epaint_default_fonts" +categories = ["graphics", "gui"] +keywords = ["graphics", "gui", "egui"] +include = [ + "../LICENSE-APACHE", + "../LICENSE-MIT", + "**/*.rs", + "Cargo.toml", + "fonts/*.ttf", + "fonts/*.txt", + "fonts/OFL.txt", + "fonts/UFL.txt", +] + +[lints] +workspace = true + +[package.metadata.docs.rs] +all-features = true diff --git a/crates/epaint_default_fonts/README.md b/crates/epaint_default_fonts/README.md new file mode 100644 index 00000000000..4a1006310a7 --- /dev/null +++ b/crates/epaint_default_fonts/README.md @@ -0,0 +1,11 @@ +# `epaint_default_fonts` - fonts for epaint and egui + +[![Latest version](https://img.shields.io/crates/v/epaint_default_fonts.svg)](https://crates.io/crates/epaint_default_fonts) +[![Documentation](https://docs.rs/epaint_default_fonts/badge.svg)](https://docs.rs/epaint_default_fonts) +[![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/) +![MIT](https://img.shields.io/badge/license-MIT-blue.svg) +![Apache](https://img.shields.io/badge/license-Apache-blue.svg) + +Default fonts that are used in `epaint` and `egui`. Not intended for use as a standalone library. + +Made for [`egui`](https://github.com/emilk/egui/). diff --git a/crates/epaint/fonts/Hack-Regular.ttf b/crates/epaint_default_fonts/fonts/Hack-Regular.ttf similarity index 100% rename from crates/epaint/fonts/Hack-Regular.ttf rename to crates/epaint_default_fonts/fonts/Hack-Regular.ttf diff --git a/crates/epaint/fonts/Hack-Regular.txt b/crates/epaint_default_fonts/fonts/Hack-Regular.txt similarity index 100% rename from crates/epaint/fonts/Hack-Regular.txt rename to crates/epaint_default_fonts/fonts/Hack-Regular.txt diff --git a/crates/epaint/fonts/NotoEmoji-Regular.ttf b/crates/epaint_default_fonts/fonts/NotoEmoji-Regular.ttf similarity index 100% rename from crates/epaint/fonts/NotoEmoji-Regular.ttf rename to crates/epaint_default_fonts/fonts/NotoEmoji-Regular.ttf diff --git a/crates/epaint/fonts/OFL.txt b/crates/epaint_default_fonts/fonts/OFL.txt similarity index 100% rename from crates/epaint/fonts/OFL.txt rename to crates/epaint_default_fonts/fonts/OFL.txt diff --git a/crates/epaint/fonts/UFL.txt b/crates/epaint_default_fonts/fonts/UFL.txt similarity index 97% rename from crates/epaint/fonts/UFL.txt rename to crates/epaint_default_fonts/fonts/UFL.txt index 6e722c88daa..ae78a8f94ea 100755 --- a/crates/epaint/fonts/UFL.txt +++ b/crates/epaint_default_fonts/fonts/UFL.txt @@ -1,96 +1,96 @@ -------------------------------- -UBUNTU FONT LICENCE Version 1.0 -------------------------------- - -PREAMBLE -This licence allows the licensed fonts to be used, studied, modified and -redistributed freely. The fonts, including any derivative works, can be -bundled, embedded, and redistributed provided the terms of this licence -are met. The fonts and derivatives, however, cannot be released under -any other licence. The requirement for fonts to remain under this -licence does not require any document created using the fonts or their -derivatives to be published under this licence, as long as the primary -purpose of the document is not to be a vehicle for the distribution of -the fonts. - -DEFINITIONS -"Font Software" refers to the set of files released by the Copyright -Holder(s) under this licence and clearly marked as such. This may -include source files, build scripts and documentation. - -"Original Version" refers to the collection of Font Software components -as received under this licence. - -"Modified Version" refers to any derivative made by adding to, deleting, -or substituting -- in part or in whole -- any of the components of the -Original Version, by changing formats or by porting the Font Software to -a new environment. - -"Copyright Holder(s)" refers to all individuals and companies who have a -copyright ownership of the Font Software. - -"Substantially Changed" refers to Modified Versions which can be easily -identified as dissimilar to the Font Software by users of the Font -Software comparing the Original Version with the Modified Version. - -To "Propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification and with or without charging -a redistribution fee), making available to the public, and in some -countries other activities as well. - -PERMISSION & CONDITIONS -This licence does not grant any rights under trademark law and all such -rights are reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of the Font Software, to propagate the Font Software, subject to -the below conditions: - -1) Each copy of the Font Software must contain the above copyright -notice and this licence. These can be included either as stand-alone -text files, human-readable headers or in the appropriate machine- -readable metadata fields within text or binary files as long as those -fields can be easily viewed by the user. - -2) The font name complies with the following: -(a) The Original Version must retain its name, unmodified. -(b) Modified Versions which are Substantially Changed must be renamed to -avoid use of the name of the Original Version or similar names entirely. -(c) Modified Versions which are not Substantially Changed must be -renamed to both (i) retain the name of the Original Version and (ii) add -additional naming elements to distinguish the Modified Version from the -Original Version. The name of such Modified Versions must be the name of -the Original Version, with "derivative X" where X represents the name of -the new work, appended to that name. - -3) The name(s) of the Copyright Holder(s) and any contributor to the -Font Software shall not be used to promote, endorse or advertise any -Modified Version, except (i) as required by this licence, (ii) to -acknowledge the contribution(s) of the Copyright Holder(s) or (iii) with -their explicit written permission. - -4) The Font Software, modified or unmodified, in part or in whole, must -be distributed entirely under this licence, and must not be distributed -under any other licence. The requirement for fonts to remain under this -licence does not affect any document created using the Font Software, -except any version of the Font Software extracted from a document -created using the Font Software may only be distributed under this -licence. - -TERMINATION -This licence becomes null and void if any of the above conditions are -not met. - -DISCLAIMER -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF -COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER -DEALINGS IN THE FONT SOFTWARE. +------------------------------- +UBUNTU FONT LICENCE Version 1.0 +------------------------------- + +PREAMBLE +This licence allows the licensed fonts to be used, studied, modified and +redistributed freely. The fonts, including any derivative works, can be +bundled, embedded, and redistributed provided the terms of this licence +are met. The fonts and derivatives, however, cannot be released under +any other licence. The requirement for fonts to remain under this +licence does not require any document created using the fonts or their +derivatives to be published under this licence, as long as the primary +purpose of the document is not to be a vehicle for the distribution of +the fonts. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this licence and clearly marked as such. This may +include source files, build scripts and documentation. + +"Original Version" refers to the collection of Font Software components +as received under this licence. + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to +a new environment. + +"Copyright Holder(s)" refers to all individuals and companies who have a +copyright ownership of the Font Software. + +"Substantially Changed" refers to Modified Versions which can be easily +identified as dissimilar to the Font Software by users of the Font +Software comparing the Original Version with the Modified Version. + +To "Propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification and with or without charging +a redistribution fee), making available to the public, and in some +countries other activities as well. + +PERMISSION & CONDITIONS +This licence does not grant any rights under trademark law and all such +rights are reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of the Font Software, to propagate the Font Software, subject to +the below conditions: + +1) Each copy of the Font Software must contain the above copyright +notice and this licence. These can be included either as stand-alone +text files, human-readable headers or in the appropriate machine- +readable metadata fields within text or binary files as long as those +fields can be easily viewed by the user. + +2) The font name complies with the following: +(a) The Original Version must retain its name, unmodified. +(b) Modified Versions which are Substantially Changed must be renamed to +avoid use of the name of the Original Version or similar names entirely. +(c) Modified Versions which are not Substantially Changed must be +renamed to both (i) retain the name of the Original Version and (ii) add +additional naming elements to distinguish the Modified Version from the +Original Version. The name of such Modified Versions must be the name of +the Original Version, with "derivative X" where X represents the name of +the new work, appended to that name. + +3) The name(s) of the Copyright Holder(s) and any contributor to the +Font Software shall not be used to promote, endorse or advertise any +Modified Version, except (i) as required by this licence, (ii) to +acknowledge the contribution(s) of the Copyright Holder(s) or (iii) with +their explicit written permission. + +4) The Font Software, modified or unmodified, in part or in whole, must +be distributed entirely under this licence, and must not be distributed +under any other licence. The requirement for fonts to remain under this +licence does not affect any document created using the Font Software, +except any version of the Font Software extracted from a document +created using the Font Software may only be distributed under this +licence. + +TERMINATION +This licence becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER +DEALINGS IN THE FONT SOFTWARE. diff --git a/crates/epaint/fonts/Ubuntu-Light.ttf b/crates/epaint_default_fonts/fonts/Ubuntu-Light.ttf similarity index 100% rename from crates/epaint/fonts/Ubuntu-Light.ttf rename to crates/epaint_default_fonts/fonts/Ubuntu-Light.ttf diff --git a/crates/epaint/fonts/emoji-icon-font-mit-license.txt b/crates/epaint_default_fonts/fonts/emoji-icon-font-mit-license.txt similarity index 100% rename from crates/epaint/fonts/emoji-icon-font-mit-license.txt rename to crates/epaint_default_fonts/fonts/emoji-icon-font-mit-license.txt diff --git a/crates/epaint/fonts/emoji-icon-font.ttf b/crates/epaint_default_fonts/fonts/emoji-icon-font.ttf similarity index 100% rename from crates/epaint/fonts/emoji-icon-font.ttf rename to crates/epaint_default_fonts/fonts/emoji-icon-font.ttf diff --git a/crates/epaint/fonts/list_fonts.py b/crates/epaint_default_fonts/fonts/list_fonts.py similarity index 100% rename from crates/epaint/fonts/list_fonts.py rename to crates/epaint_default_fonts/fonts/list_fonts.py diff --git a/crates/epaint_default_fonts/src/lib.rs b/crates/epaint_default_fonts/src/lib.rs new file mode 100644 index 00000000000..f3dad7de867 --- /dev/null +++ b/crates/epaint_default_fonts/src/lib.rs @@ -0,0 +1,47 @@ +//! A library containing built-in fonts for `epaint`, embedded as bytes. +//! +//! This is intended to be consumed through the `epaint` crate. + +/// A typeface designed for source code. +/// +/// Hack is designed to be a workhorse typeface for source code. It has deep +/// roots in the free, open source typeface community and expands upon the +/// contributions of the [Bitstream Vera](https://www.gnome.org/fonts/) and +/// [DejaVu](https://dejavu-fonts.github.io/) projects. The large x-height + +/// wide aperture + low contrast design make it legible at commonly used source +/// code text sizes with a sweet spot that runs in the 8 - 14 range. +/// +/// See [the Hack repository](https://github.com/source-foundry/Hack) for more +/// information. +pub const HACK_REGULAR: &[u8] = include_bytes!("../fonts/Hack-Regular.ttf"); + +/// A typeface containing emoji characters as designed for the Noto font family. +/// +/// Noto is a collection of high-quality fonts with multiple weights and widths +/// in sans, serif, mono, and other styles, in more than 1,000 languages and +/// over 150 writing systems. Noto Emoji contains black-and-white emoji +/// characters that match Google's emoji designs. +/// +/// See [Google Fonts](https://fonts.google.com/noto/specimen/Noto+Emoji) for +/// more information. +pub const NOTO_EMOJI_REGULAR: &[u8] = include_bytes!("../fonts/NotoEmoji-Regular.ttf"); + +/// A typeface designed for use by Ubuntu. +/// +/// The Ubuntu typeface has been specially created to complement the Ubuntu tone +/// of voice. It has a contemporary style and contains characteristics unique to +/// the Ubuntu brand that convey a precise, reliable and free attitude. +/// +/// See [Ubuntu design](https://design.ubuntu.com/font) for more information. +pub const UBUNTU_LIGHT: &[u8] = include_bytes!("../fonts/Ubuntu-Light.ttf"); + +/// An experimental typeface that uses standardized +/// [UNICODE planes](http://en.wikipedia.org/wiki/Plane_(Unicode)) +/// for icon fonts. +/// +/// The icons in this font are designed to be styled with minimal effort. Each +/// icon is solid, which is useful for changing icon colors. +/// +/// See [the `emoji-icon-font` repository](https://github.com/jslegers/emoji-icon-font) +/// for more information. +pub const EMOJI_ICON: &[u8] = include_bytes!("../fonts/emoji-icon-font.ttf"); diff --git a/examples/custom_font/src/main.rs b/examples/custom_font/src/main.rs index 8960a8fe82b..5afa72905af 100644 --- a/examples/custom_font/src/main.rs +++ b/examples/custom_font/src/main.rs @@ -25,7 +25,7 @@ fn setup_custom_fonts(ctx: &egui::Context) { fonts.font_data.insert( "my_font".to_owned(), egui::FontData::from_static(include_bytes!( - "../../../crates/epaint/fonts/Hack-Regular.ttf" + "../../../crates/epaint_default_fonts/fonts/Hack-Regular.ttf" )), ); diff --git a/scripts/generate_changelog.py b/scripts/generate_changelog.py index eaa5d2ee4dc..414a4a5af34 100755 --- a/scripts/generate_changelog.py +++ b/scripts/generate_changelog.py @@ -228,6 +228,7 @@ def main() -> None: "egui-winit", "egui", "epaint", + "epaint_default_fonts", ] # We read all existing changelogs to remove duplicate entries.