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

Use rusttype instead of freetype-rs #38

Open
kvark opened this issue Feb 5, 2016 · 10 comments

Comments

@kvark
Copy link
Member

commented Feb 5, 2016

See https://github.com/dylanede/rusttype

A pure Rust alternative to libraries like FreeType.

@Kagami

This comment has been minimized.

Copy link
Member

commented Feb 5, 2016

Are there any advantages except removing freetype dependency (which is rather inconvenient to setup properly on Windows)? Library looks too young yet. Though I have no objections if it works good with common ttf fonts.

@kvark

This comment has been minimized.

Copy link
Member Author

commented Feb 5, 2016

No rush on this, of course, but I figured we need to have an issue at least to keep rusttype on our radars;)

@kvark

This comment has been minimized.

Copy link
Member Author

commented Mar 21, 2016

Now that rusttype got gpu caching, it is twice as important to have some glue to it in order to encapsulate all the boiler plate. RustType has an example with glium, and you can see how much code could be saved there. cc @dylanede

@Kagami

This comment has been minimized.

Copy link
Member

commented Mar 21, 2016

Interesting. Though currently in gfx_text we create texture with all needed glyphs on initialization step (i.e. once at start before main loop), so this will probably require architecture changes.

@dylanede

This comment has been minimized.

Copy link

commented Mar 21, 2016

@kvark A lot of the code in the example is probably analogous to existing code in gfx_text. Stuff like keeping track of which glyphs to draw, producing the quads to draw etc. There will need to be a wrapper around the caching mechanism itself though. You will need to decide how to handle exceptional conditions, like what to do if there's not enough room in the cache to fit all the required glyphs for the current frame. I've written up some information about the possible choices in the gpu_cache module documentation.

I also plan to clean up the caching example to separate the stuff specific to caching from the stuff specific to rendering with glium.

@aschuhardt

This comment has been minimized.

Copy link

commented Mar 3, 2017

Is there any update on this?

@bvssvni

This comment has been minimized.

Copy link
Member

commented Mar 4, 2017

Should not be too hard. We have already ported the Piston 2D graphics backends to RustType. Example: https://github.com/PistonDevelopers/gfx_graphics/blob/master/src/glyph.rs

@norru

This comment has been minimized.

Copy link

commented Nov 29, 2017

If it helps, I have replaced the low level gfx_text debug with a full blown Conrod-based HUD in rust-oids. Conrod uses rusttype to draw text, which is nice as I now have one fewer native lib to link in. Performance appears worse (not measured it, just perceptual) but given the simple stuff I'm drawing, shouldn't be much of a hassle. Simple debug text based on gfx_text would be nice to re-add if and when the project switches to rusttype as I pretty much will have that for free!

@norru

This comment has been minimized.

Copy link

commented Nov 29, 2017

Rounding up on older posts on the matter. Is gfx_text still recommended for simple text drawing, or it has been superseded by something rust-native and better?

@marek-g

This comment has been minimized.

Copy link

commented Mar 12, 2018

rusttype doesn't support font hinting yet. This makes glyphs look uglier for smaller sizes. Especially because of lack of vertical hinting. For example, the H letter will have antialiased pixels at the top which is not the case for freetype and fonts with hinting rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.