Commit graph

20 commits

Author SHA1 Message Date
Daniel Eklöf
5ab35a38d5
font: fix estimated underline thickness; descent is typically negative 2019-11-30 23:14:26 +01:00
Daniel Eklöf
9c89250a2d
font: fix fixed-float -> double conversion 2019-11-30 15:41:13 +01:00
Daniel Eklöf
c85e52c3c3
font: sync underline_strikeout_metrics() with more recent version of font
Sigh, I really need to break out font.c/font.h to a separate
library...
2019-11-30 15:40:21 +01:00
Daniel Eklöf
732470e5a6
font: use double, not int, in intermediate metrics calculation 2019-11-27 21:53:27 +01:00
Daniel Eklöf
fa725c69d5
font: ceil and scale glyph horizontal advance 2019-11-27 21:43:52 +01:00
Daniel Eklöf
303b61a2e6
font: fix calculation of scaled glyph horizontal offset 2019-11-27 21:42:16 +01:00
Daniel Eklöf
e837e71179
font: set pixman filter when re-scaling glyph 2019-11-27 21:41:49 +01:00
Daniel Eklöf
c72893637c
font: force a pixel fixup factor for scalable bitmap fonts
That is, for color bitmap fonts (typically emoji fonts). Use the same
calculation used by fontconfig's 10-scale-bitmap-fonts.conf.

Note: if the user has enabled bitmap font scaling in general, we'll
pick it up and scale the final glyph image, regardless of whether the
font is a regular bitmap font, or a color bitmap font.

But, if the user has disabled bitmap font scaling, we only force a
fixup factor on color bitmap fonts.
2019-11-27 21:41:29 +01:00
Daniel Eklöf
7e8617f090
font: use FT_Set_Pixel_Sizes() instead of FT_Set_Char_Size()
And bail out if we fail
2019-11-27 21:40:02 +01:00
Daniel Eklöf
feddc19b36
font: rename 'size' -> 'pixel_size' 2019-11-27 21:39:30 +01:00
Daniel Eklöf
b48365aa86
font: remove the fextents sub-struct 2019-11-27 21:38:49 +01:00
Daniel Eklöf
e5fb7f32b4
font: add commented out code to calculate underline/strikeout metrics
This is just to sync the font implementation in yambar with my other
projects. Underlines and strikouts aren't (yet) used in yambar.
2019-09-29 13:07:06 +02:00
Daniel Eklöf
4e73ec669b
font: don't try to do fontconfig fallback on a fallback font 2019-09-22 12:44:08 +02:00
Daniel Eklöf
54797ffbd8
font: remove lock (all rendering happens in the main thread) 2019-09-22 00:51:02 +02:00
Daniel Eklöf
b3a5e0b5d7
font: initial port from cairo scaled fonts to raw freetype + pixman 2019-09-22 00:50:11 +02:00
Daniel Eklöf
41c53a7b2f font: ref-count font objects 2019-01-15 21:01:18 +01:00
Daniel Eklöf
7525ae99eb font: cache loaded fonts
Instantiating a new font is expensive, both in CPU and
memory. Mitigate by adding a cache. On a hit, instead of instantiating
a new font, clone the one from the cache.

Remember, cloning is basically just a ref counter bump.
2019-01-15 20:48:04 +01:00
Daniel Eklöf
770f2a0e7c font: allow font_destroy() to be called with a NULL pointer 2019-01-13 13:24:56 +01:00
Daniel Eklöf
f6977417e0 font: use font-config to load font
This allows us to a) move away from cairo's "toy" API, and b) let the
user specify font options in a single font "name" string:

  Serif:size=10:weight=bold:slant=italic

This also allows us to simplify the font code significantly (except
for the fontconfig parts...); the font no longer sets itself in a
cairo surface - font users do that; the font simply returns a
cairo_scaled_font_t.

Furthermore, font_clone() has now been simplified to basically just
refcount the scaled font. I.e. there's no need to run the full
constructor and lookup and instantiate the cairo scaled font again.
2019-01-09 18:50:16 +01:00
Daniel Eklöf
8bf8a398b9 initial commit: wip 2018-11-17 11:30:33 +01:00