On Wed, 2018-02-14 at 20:50 +0100, Heiko Tietze wrote:
> I presented first ideas at FOSDEM [3] that can
> be used as a draft.
> 
> [3] https://de.slideshare.net/HeikoTietze/improvements-to-font-
> handling-in-libreoffice

I believe the preview mock up previews the difference from the missing
font to the font its replaced with ? How would that get implemented in
the absence of the missing font ? Just for some small set of known
fonts with known metrics or something ?

As mostly an aside, but maybe worth mentioning to clarify how some of
this works under the hood, is that there is both "font substitution"
and "glyph substitution" going on. Font substitution is what's shown
here, LibreOffice asks for a font and gets a different one back because
the original is not available. IIRC the users overrides are used first
for font substitution, then under Linux fontconfig is asked. On the
other platforms the massive table of fonts listing in the config is
used to try and find something.

Added to the mix is the "Default" font which is listed in VCL.xcu and
is the font to use for various categories as the default document fonts
for a given language. These are lists per language and per category,
under fontconfig systems the first font is taken and if not available
fontconfig is asked for a replacement font based on the first entry,
which other platforms try the whole list until something crops up.

There are other substitution routes too, e.g. there's a specific route
to map known fonts to the closest matching font available in MSOffice,
e.g. when you write using Liberation Sans and save to .doc[x] the
recommended fallback of "Arial" is found on this route and set in those
file formats so the document gets rendered by MSOffice in Arial when
Liberation Sans is missing on the target system.

That's the relatively simple font substitution, in glyph substitution a
range of glyphs are discovered to not exist in the font (perhaps from
initial font substitution) at render time and libreoffice desperately
searches for something, anything, that can render the glyph. On windows
IIRC there's a bunch of hardcoded fonts to make an effort to find the
glyph in, while with fontconfig we throw the original font, missing
glyphs, size, slant, language etc at fontconfig and it does the work of
finding something. In extremis, if enabled, libreoffice will even
prompt via packagekit that a font for the language that the glyphs are
(probably) for get installed.

Which leads to straightforward things such as you can get a different
font for the missing glyphs if the language is Japanese vs Chinese. And
it can lead to awe inspiring things where different fonts are suggested
for the same missing glyphs at different sizes. You can even be asked
to substitute effectively the *same* font that the glyphs are missing
from, e.g. glyphs are missing from a bold font, but exist in the
regular version and fontconfig suggests using the regular version with
artificial emboldening. Glyph substitution is very exciting.
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to