Commit graph

15 commits

Author SHA1 Message Date
Olivier Goffart
1b91158b46 corelib: allow to use i32 for coordinate instead of f32 2022-04-11 17:46:50 +02:00
Simon Hausmann
f57e9ef50c Adapt to the TextShaper API changes in the mcu font backend 2022-03-10 10:51:32 +01:00
Simon Hausmann
f6b484ca91 Implement glyph_for_char in mcu font to support elision 2022-03-10 10:51:32 +01:00
Simon Hausmann
9b9d6efdc8 Adapt the mcu text code to use glyph based layout callback 2022-03-10 10:51:32 +01:00
Simon Hausmann
089dc47b66 Adapt the mcu font handling to the glyph trait based textshaper 2022-03-10 10:51:32 +01:00
Simon Hausmann
a555ad780a Adapt to TextShaper trait changes 2022-03-10 10:51:32 +01:00
Simon Hausmann
b9a7977ad3 Fix glyph cluster offset in the MCU pixel font "shaping"
Always specify a byte offset, even for absent glyphs.
2022-03-10 10:51:32 +01:00
Simon Hausmann
35644d4026 Implement text_size for the mcu backend with line breaks 2022-03-10 10:51:32 +01:00
Simon Hausmann
bf08ed2847 Begin implementing text layout traits 2022-03-10 10:51:32 +01:00
Simon Hausmann
b27dc9109a Clean up MCU font handling code a little
Dedicated a PixelFont struct to the combo of generic font and pixel-size matched glyphs.
2022-03-10 10:51:32 +01:00
Simon Hausmann
02dcf1173b Simplify conversion from physical to logical pixels in the mcu backend
It turns out that after casting to the f32 variant we can divide the by scale factor instead of multiplying
with the inverse.
2022-02-17 15:07:57 +01:00
Simon Hausmann
f912ec7e6b Fix scaling of glyphs and improve type safety in the MCU backend
The code was mixing logical and physical sizes, causing glyphs being
doubly scaled down. Instead, this patch introduces:

 * Physical* and Logical* euclid length/size/rect aliases
 * some extraction traits for getting the scalars in rects/sizes as lengths (until euclid has them
built-in)
 * wrapper traits/types for safely extracting the physical font metrics the
 compiler generates (i16)
 * Fix a bug in the text height calculation where we failed to take the
   descent into account
2022-02-17 15:07:57 +01:00
Simon Hausmann
07da5c1c36 janitor: Fix license headers 2022-02-15 15:55:41 +01:00
Simon Hausmann
ba9705010e Fix mismatch between logical and physical pixel sizes
The embedded glyphs use physical pixel sizes while the incoming font requests uses logical pixels.
2022-02-15 15:52:24 +01:00
Simon Hausmann
4424b0ecb5 Start stubbing out primitive glyph rendering in the mcu backend
This is still relatively heavy in terms of memory consumption, we
generate a scene item per glyph.
2022-02-15 15:52:24 +01:00