Giter VIP home page Giter VIP logo

Comments (7)

tomassedovic avatar tomassedovic commented on May 15, 2024 1

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.

emilk avatar emilk commented on May 15, 2024

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.

tomassedovic avatar tomassedovic commented on May 15, 2024

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.

emilk avatar emilk commented on May 15, 2024

Let me know if you start working on this, otherwise I'll get to it... some time? :)

from egui.

tomassedovic avatar tomassedovic commented on May 15, 2024

This is awesome, thank you so much!

from egui.

pepperoni42069 avatar pepperoni42069 commented on May 15, 2024

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.

emilk avatar emilk commented on May 15, 2024

@Eskerepvp it's because you are reading a two year old issue instead of the latest documentation.

from egui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.