Commit graph

11 commits

Author SHA1 Message Date
Simon Hausmann
fe079c644e Simplify byte offset vs. char index handling in the font code
Use char_indices() already for string_to_glyphs.
2020-09-22 18:47:15 +02:00
Simon Hausmann
570e51eaa9 Improve API of color handling of text
Make the text color a rendering variable, so that it can be passed
through as uniform to the glyph shader and applied to the gray
map of the glyphs. This avoids re-creating the glyph runs when
merely the color changes.

This already "worked" for the glyph cache based text rendering,
but it wasn't used because of the wasm canvas code path. This
patch changes that to render the text into a text using simply black
and then render that texture using our existing glyph shader,
which merely uses the alpha channel anyway.

This reduces also #cfg's.
2020-09-02 11:48:41 +02:00
Olivier Goffart
58cdaeb8dd Update license header to mention that commertial option are available 2020-08-26 13:23:42 +02:00
Simon Hausmann
2823f32692 Apply license headers to all non-binary/non-json sources 2020-08-17 17:55:20 +02:00
Simon Hausmann
a54f222e52 Clean up glyph run creation code
Move more into the glyph cache module
2020-08-13 10:48:27 +02:00
Simon Hausmann
df2620838e Improve RefCell usage
Use a RefCell only where we need it, in the glyph cache. We don't need
it for the platform data.
2020-08-13 10:23:08 +02:00
Simon Hausmann
ccb2e23cf5 Fix GL texture not freeing its texture id
Similar to the shaders, keep a reference count on the resource itself and
keep the context around for convenient deletion.

Fixes: #3
2020-08-10 11:20:58 +02:00
Simon Hausmann
f86f8360b2 Fix rendering of text with spaces
Don't waste glyphs and potential pixels from the rasterizer for space --
merely use the advance.
2020-08-07 15:32:59 +02:00
Simon Hausmann
893124d64e Minor cleanup in glyph cache code
Merge string_to_glyphs and layout_glyphs -- they only make sense together here.
2020-07-28 14:22:34 +02:00
Simon Hausmann
cd77171bbc Move all glyph cache related code into one module 2020-07-28 14:22:34 +02:00
Simon Hausmann
c102fca828 Move the glyph rasterization code into the new font module in corelib 2020-07-28 14:22:34 +02:00