Apache OpenOffice (AOO) Bugzilla – Issue 19591
Font subst semantics does not match specs (helpcontent doc)
Last modified: 2004-06-28 07:19:50 UTC
Considering this excerpt from help: "Select Always to replace both the screen font and the printer font, even if the original font is installed on your system. Select Screen to replace the screen font only." My interpretation is that if there is a font substitution such that "Helvetica" maps to "Luxi Sans" (or "Bitstream Vera Sans") and only "Screen" box is checked, then Helvetica is substituted on screen only, including helpcontent. Right? However, opening helpcontent yields that the <HeadN> text is not anti-aliased (helvetica is not anti-alias capable under Linux with default fonts). i.e. I conclude font substitution was not taken into account. If, I were to check the "Always" box, I get correct font substitution (anti aliased text this time). I believe font subst logics is reversed in ImplFontCache::Get().
Let's make a truth table from the help specs. There are two cases: 1) A printer device Always ScreenOnly Substitute 0 0 NO 0 1 NO 1 0 YES 1 1 NO 2) A screen device Always ScreenOnly Substitute 0 0 NO 0 1 YES 1 0 YES 1 1 YES Assuming the truth tables are correct, the reader can induce the resulting mask,match code. ;-)
The resulting boolean function is: (!P && S) || (A && !S) with the following variables: - P: is it a printer device? - A: always? - S: on screen only? I don't know German, but I am attaching a tentative fix.
Created attachment 9328 [details] Make font substitution algorithm match doc
*** Issue 19589 has been marked as a duplicate of this issue. ***
cp->ssa: I would assume that "always" makes the "screen only" setting irrelevant. Please have a look.
i.e. ignore the "ScreenOnly" attribute even for a printer device? In that case, this complicates a bit the boolean expression. I am reaching: (P && A) || (!P && (S || (A && !S))). I don't know how to factor out this one better. NOTE: use the usual Boole algebreaic notation to read that better. ;-)
ssa->hdu: please have a look.
Thanks for working on this unpleasant part of the code. The font list management and caches are due for a rework soon. I'm applying the patch with this expression (P && A) || (!P && (S || A))
This should have been (A || (!P && S))
Digging into the code and its comments it looks like the complete truth table is supposed to be: Always ScreenOnly Available ForDisplay => Substitute 0 0 0 x 1 0 0 1 x 0 0 1 x 0 0 0 1 x 1 1 1 0 x x 1 1 1 x x undefined (default to 1) Don't blame me, I just inherited it. I'd rather not touch this font matching code again until the rewrite is due. Font matching is extremely critical for the whole document layout.
Fixed in CWS vcl7pp1r4.
HDU->US: please verify in CWS vcl7pp1r4.
changing Resolution to FIXED in order to mark issue verified.
VERIFIED! Thanks HDU for the good work! US->US: especially the following constellation may be misleading. Note: the resulting substitution refers to the device specified in the column before. This means concrete: "[font] ForDisplay" == "0" is a printer font and the substitution is "0" on the printer device. But on the screen there is a visible substitution, as specified by the user by "ScreenOnly" == "1". Always ScreenOnly Available ForDisplay => Substitute 0 1 x 0 0
.
Re-verified on resynced cws vcl7pp1r4.
ok in (internal) master workspace srx645_m27s1-1.8738. Fix will be in fortcoming OOo 1.1.1. Closing Resolved/Verified issue.
I've looked at OOo 1.1.3, but this seems not yet fixed, because it doesn't take into account whether the font to be substituted is installed or not. Suppose I've the substitution: Always Screen Font Replace with [N] [Y] Arial => Bitstream Vera Sans In this way, when "Arial" is not available/installed would use "Bitstream Vera Sans"; but suppose then I install the "Arial" (arial32.exe) font using the FontOOo wizard. At next OOo startup the Arial font would be available and thus Arial should be used and the substitution "Arial => Bitstream Vera Sans" shouldn't be performed; but indeed OOo 1.1.3 still performs this substitution, and thus not taking care at all whether the font to be substituted is added (exists) to OOo or not.
@ghibo: replacements as configured in OO.o's Tools-Options-OO.o-Fonts dialog *always* perform a replacement no matter whether the substituted font is available or not. Works as designed. What you want is a font substitution (fallback list) for unavailable fonts. Pls. refer to <OO.o_root_dir>/share/registry/data/org/openoffice/VCL.xcu.