aboutsummaryrefslogtreecommitdiff
path: root/font.c (follow)
Commit message (Collapse)AuthorAgeLines
* tllist: remove git submodule and local copy under subprojectsDaniel Eklöf2019-12-01-809/+0
|
* font: log fontconfig/freetype version when debug logging has been enabledDaniel Eklöf2019-12-01-0/+20
|
* Revert "font: ceil:ing the top value seems to look better when scaled"Daniel Eklöf2019-12-01-1/+1
| | | | This reverts commit 95d97b39734026e05f47b2064fe686da1ae40d20.
* font: ceil:ing the top value seems to look better when scaledDaniel Eklöf2019-11-30-1/+1
|
* font: fix estimated underline thickness; descent is typically negativeDaniel Eklöf2019-11-30-1/+1
|
* render: fix underline/strikeout positioningDaniel Eklöf2019-11-30-9/+9
| | | | | | | | | | | | There were two errors: * We subtracted half the line width instead of adding it to the baseline * We rounded the line positioning and thickness before the positioning calculation. In particular, rounding the thickness before using it to adjust the position was wrong. Now we round just before the pixman call.
* font: bug: bad multiplier when converting from 16.16 fixed floatDaniel Eklöf2019-11-30-1/+1
|
* font: cache_size -> glyph_cache_sizeDaniel Eklöf2019-11-30-4/+4
| | | | This makes it more clear it has nothing to do with the font cache.
* font: destructor: pop elements as we goDaniel Eklöf2019-11-30-1/+1
| | | | Otherwise we'll end up free:ing the same font over and over again.
* font: original -> requestedDaniel Eklöf2019-11-30-8/+8
|
* font: log freetype errorsDaniel Eklöf2019-11-30-3/+19
|
* font: never set glyph->cols to something that is less than 0Daniel Eklöf2019-11-29-1/+4
|
* font: add missing ';'Daniel Eklöf2019-11-28-1/+1
|
* font: use pixelsizefixupfactor on regular bitmap fonts too, if setDaniel Eklöf2019-11-28-12/+9
| | | | | But if it isn't set, only estimate it if the font is a *scalable* non-outline (bitmap) font.
* font: set pixman filter when re-scaling glyphDaniel Eklöf2019-11-27-14/+5
|
* font: estimate pixel size fixup when not provided by fontconfigDaniel Eklöf2019-11-26-25/+73
| | | | | | But only do this when the font is scalable but not an outline. This is only true for color bitmap fonts (emoji fonts), and not e.g. regular bitmap fonts.
* font: use DPI=75 if there's no DPI attribute from fontconfigDaniel Eklöf2019-11-26-1/+1
| | | | This is the fontconfig default as well
* font: underline/strikeout: use y-scale, not x-scaleDaniel Eklöf2019-11-26-9/+9
|
* font: move metrics from terminal struct to font structDaniel Eklöf2019-11-26-0/+16
|
* font: cleanup and return error when failing to load font fileDaniel Eklöf2019-11-25-1/+4
|
* font: use FT_Set_Pixel_Sizes() instead of FT_Set_Char_Size()Daniel Eklöf2019-11-25-2/+8
| | | | Since we're working with pixel sizes anyway...
* font: don't spam failures to lookup glyphsDaniel Eklöf2019-11-20-2/+2
|
* font: cache loaded fonts globallyDaniel Eklöf2019-11-01-0/+52
| | | | | | | | | Each font instance has a ref-counter. Whenever we want to instantiate a font that has already been loaded, we instead return the already-loaded instance, and bump the ref counter. When the last font instance is destroyed, it is also removed from the cache.
* font: glyph_for_wchar(): ensure glyph->valid == false, in *all* error casesDaniel Eklöf2019-10-18-4/+6
|
* font: load fallback fonts on demandDaniel Eklöf2019-10-17-18/+29
| | | | | | | | | | | When instantiating a primary font, build the fallback font list, but don't actually instantiate the fallback fonts. Instead, remember the (full) pattern that we should use if/when we instantiate it. Then, when looking up a glyph and we need a fallback font, loop the list and instantiate the font(s) there and then.
* font: load all fallbacks when instantiating a primary fontDaniel Eklöf2019-10-17-114/+41
| | | | | | | | | | | | | | | The caching of fallback fonts didn't work. It "worked" because we didn't free the fonts... When we started doing that, the fallback fonts were no longer cached. Another solution would have been to keep the cached fallback fonts around until exit, and free them there. But that didn't seem very clean. So, for now, load *all* fallbacks when instantiating a primary (non-fallback) font. Note that this slows down initial startup time.
* font: rename cache -> glyph_cacheDaniel Eklöf2019-10-17-13/+15
|
* font: fc_idx may not be the requested oneDaniel Eklöf2019-10-17-2/+4
|
* font: rename fc_loaded_fonts -> fc_loaded_fallbacksDaniel Eklöf2019-10-17-10/+11
|
* font: cache top-level fontsDaniel Eklöf2019-10-16-1/+62
| | | | | | | | This greatly improves the performance when loading user-configured fallback fonts. Previously, we had to re-load these fallback fonts over and over again for each (new) glyph.
* font: from_name() returns an allocated font structDaniel Eklöf2019-10-16-22/+19
|
* font: cache loaded fontconfig fallback fontsDaniel Eklöf2019-10-16-19/+51
|
* font: font_from_name() returns an allocated font structDaniel Eklöf2019-10-16-3/+7
|
* font: calculate underline/strikeout metrics in font, not mainDaniel Eklöf2019-09-29-0/+41
|
* font: tentative support for BGR, V-RGB and V-BGRDaniel Eklöf2019-08-19-7/+22
|
* refactor: break out stride calculation to new functionDaniel Eklöf2019-08-18-2/+2
|
* font: implement subpixel antialiasingDaniel Eklöf2019-08-18-48/+76
|
* Remove all references to cairo; we now use pixman onlyDaniel Eklöf2019-08-16-1/+1
|
* wip: render background and glyphs using pixmanDaniel Eklöf2019-08-16-19/+33
|
* font: fix broken debug logDaniel Eklöf2019-08-16-1/+1
|
* font: don't bother creating a cairo surface for zero-width glyphsDaniel Eklöf2019-08-13-1/+4
|
* font: handle invalid glyphs correctlyDaniel Eklöf2019-08-13-1/+5
| | | | | | | | | | | | | | | | | *All* glyphs are cached. But we never set the 'wc' member of failed glyphs, causing a later cache lookup of the same glyph miss in the cache, and thus re-generate yet another glyph (that is inserted into the cache). I.e. if the same (invalid) glyph is rendered over and over again, we'll end up growing the cache indefinitely. Fix by setting the 'wc' member of invalid glyphs. This causes a cache lookup to hit. But, we must also check the glyphs validity, and return NULL if the glyph isn't valid. Finally, when destroying a font, skip invalid glyphs, since they have no resources that needs to be freed.
* font: cleanupDaniel Eklöf2019-08-10-30/+7
|
* font: initial support for fontconfig font fallbackDaniel Eklöf2019-08-10-42/+115
| | | | | | | | When we've exhausted our own fallback list, try the font list provided by fontconfig. This means, the user's fallback fonts have priority, but in case all of them fail, we hopefully get lucky with fontconfig...
* font: improve loggingDaniel Eklöf2019-08-08-6/+6
|
* cell: pack more efficiently and store glyph as a wcharDaniel Eklöf2019-08-02-16/+7
| | | | | | | | | | | The 'attributes' struct is now 8 bytes and naturally packed (used to be 9 bytes, artificially packed). 'cell' struct is now 12 bytes, naturally packed (used to be 13 bytes, artificially packed). Furthermore, the glyph is stored as a wchar instead of a char*. This makes it easier (faster) to do glyph lookup when rendering.
* font: initial support for double-width *and* color emoji glyphsDaniel Eklöf2019-07-31-31/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fonts are now loaded with FT_LOAD_COLOR and we recognize and support the FT_PIXEL_MODE_BGRA pixel mode. This is mapped to a CAIRO_FORMAT_ARGB32 surface, that is blitted as-is (instead of used as a mask like we do for gray and mono glyphs). Furthermore, since many emojis are double-width, we add initial support for double-width glyphs. These are assumed to always be utf8. When PRINT:ing an utf8 character, we check its width, and add empty "spacer" cells after the cell with the multi-column glyph. When rendering, we render the columns in each row backwards. This ensures the spacer cells get cleared *before* we render the glyph (so that we don't end up erasing part of the glyph). Finally, emoji fonts are usually bitmap fonts with *large* glyphs. These aren't automatically scaled down. I.e. even if we request a glyph of 13 pixels, we might end up getting a 100px glyph. To handle this, fontconfig must be configured to scale bitmap fonts. When it is, we can look at the 'scalable' and 'pixelsizefixup' properties, and use these to scale the rendered glyph.
* font: add support for fallback fontsDaniel Eklöf2019-07-30-32/+187
| | | | | | | | | | | | | | | A top-level font now has a list of fallback fonts. When a glyph cannot be found, we try each fallback font in turn, until we either find one that has the glyph, or until we've exhausted the list. To make this actually work in practise (read: to make performance acceptable), the cache is re-worked and is now populated on demand. It also supports non-ASCII characters, by using the 4-byte unicode character as index instead. Since having an array that can be indexed by a 4-byte value isn't really viable, we now have a simple hash table instead of an array.
* font: set FT load and render flags from FontConfig propertiesDaniel Eklöf2019-07-29-18/+121
|
* font: populate glyph cache (ASCII characters only) when instantiating fontDaniel Eklöf2019-07-28-0/+25
|
* font: add font_glyph_for_utf8()Daniel Eklöf2019-07-28-0/+76
| | | | | | This function fills in a struct glyph with glyph bitmap data for the provided utf-8 character (essentially a FT_Bitmap wrapped in a cairo surface).
* cairo-ft: remove all usages of cairo-ftDaniel Eklöf2019-07-28-38/+0
|
* font: load FreeType face, and set it's pixel sizesDaniel Eklöf2019-07-28-15/+48
|
* font: don't warn when failing to get hinting/antialiasDaniel Eklöf2019-07-18-6/+2
| | | | | | | These properties aren't always included in the pattern, and when they aren't, trying to get them will fail. This isn't an error, just fallback to a default value.
* font: remove assert that was only there for debuggingDaniel Eklöf2019-07-18-1/+0
|
* font: sync cairo's options with the FC patternDaniel Eklöf2019-07-17-1/+24
| | | | | | Configure cairo's 'options' with default values, then update the FontConfig pattern. Finally, update the cairo options after having retrieved the final FontConfig option.
* initial grid implementationDaniel Eklöf2019-06-13-0/+85
This allows us to render *something*, even though it's inefficient, stupid and far far away from the real thing.