Comments (7)
It would probably be some time here too. I'll post here if/when I pick it up! Thanks for the great suggestion!
from egui.
Hello!
There are (at least) two separate issues here:
A) Being able to override the default fonts used by Egui
B) Being able to add additional user fonts
Egui should definetly support both! I think A) is probably the first priority. In this case, maybe what you really wanted to do is to change TextStyle::Monospace
to use Mononoki
, so A) would have indeed solved it.
There is some design work to be done here before we start coding.
Let's start with thinking about A). We could start by having FontDefinitions
contain a map from FontFamily
to the TTF font data (e.g. as a ttf: HashMap<FontFamily, Vec<u8>>
member). FontDefinitions::default()
could use the default fonts, but you could then override it as such:
let mut fonts = egui::paint::FontDefinitions::default();
fonts.ttfs[FontFamily::Monospace] = include_bytes!("mononoki.ttf").to_vec();
ctx.set_fonts(fonts);
What do you think, is something like that a good start?
from egui.
Greetings!
What you proposed looks perfect! It would cover my needs completely.
I agree there's multiple things "custom font support" could mean and focussing on being able to swap the default fonts for user-specified ones is a great start.
from egui.
Let me know if you start working on this, otherwise I'll get to it... some time? :)
from egui.
This is awesome, thank you so much!
from egui.
This doesn't work...
77 | fonts.ttfs[FontFamily::Monospace] = include_bytes!("../assets/fonts/NotoEmoji-Regular.ttf").to_vec();
| ^^^^ unknown field
|
= note: available fields are: `font_data`, `families`
from egui.
@Eskerepvp it's because you are reading a two year old issue instead of the latest documentation.
from egui.
Related Issues (20)
- `with_always_on_top` causes window to display incorrectly when window size is equal to screen size HOT 12
- Displaying a JPEG image does not work with `image` crate version higher than 0.24 HOT 2
- Using the user agents capabilities for loading images on web
- `ctx.input(|i| i.focused)` always gets `false` for the first few frames
- `with_position` method of ViewportBuilder does not seem to work on wayland
- Better tooltip size management
- Error: WinitEventLoop(NotSupported(NotSupportedError))
- `Style` feature to have label truncate by default HOT 1
- Allow returning errors from eframe app creator
- `SidePanel` frame leaks into `BottomPanel` HOT 3
- Dependency fails to build on nightly
- How to avoid the CMD window pop up when running on Windows? HOT 2
- Allow for manual placement of the canvas element
- Add function to request a repaint to WebRunner
- Improve compile times of `eframe`
- [IME] Can't input CompositionEnd only characters because of checking ccursor.index and ime_cursor.index HOT 2
- Gif Support
- Custom light & dark themes on system theme change HOT 1
- Add a User-Agent header to HTTP image loader HOT 5
- Dithering in Fragment Shader HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from egui.