summaryrefslogtreecommitdiff
path: root/src/psaux
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2019-07-04 14:04:52 +0200
committerWerner Lemberg <wl@gnu.org>2019-07-04 14:26:10 +0200
commitf2b64583cb2587373e126b06d8da9ac97b287681 (patch)
tree64cf9f0fc2369ccd3d6cf80f8a583dbcc4bf4c26 /src/psaux
parent8cf046c38d4c6ada76ba070562beff0d5041f795 (diff)
downloadfreetype2-f2b64583cb2587373e126b06d8da9ac97b287681.tar.gz
[psaux] (1/2) Handle fonts that use SEAC for ligatures (#56580).
As originally intended, a Type 1 SEAC charstring would be used for an accented glyph (like `acaron' or `uumlaut'), where the advance width of the SEAC glyph is the same as that of the `base' glyph (like `a' or `u'). In this case it is not uncommon for the SEAC glyph to not use an (H)SBW opcode of its own but to rely on the value from the base glyph. However, out-of-spec fonts also use SEAC glyphs for ligatures (like `oe' or `fi'), and in those cases the overall advance width is greater than that of the `base' glyph. For this reason we have to allow that the SEAC glyph can have an (H)SBW value of its own, and if it has, retain this value, rather than the one from the base glyph. * src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_escSEAC>: Implement it.
Diffstat (limited to 'src/psaux')
-rw-r--r--src/psaux/psintrp.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c
index e2f3accdd..0a8414553 100644
--- a/src/psaux/psintrp.c
+++ b/src/psaux/psintrp.c
@@ -1433,6 +1433,13 @@
lastError = error2; /* pass FreeType error through */
goto exit;
}
+
+ /* save the left bearing and width of the SEAC */
+ /* glyph as they will be erased by the next load */
+
+ left_bearing = *decoder->builder.left_bearing;
+ advance = *decoder->builder.advance;
+
cf2_interpT2CharString( font,
&component,
callbacks,
@@ -1443,11 +1450,14 @@
&dummyWidth );
cf2_freeT1SeacComponent( decoder, &component );
- /* save the left bearing and width of the base */
- /* character as they will be erased by the next load */
+ /* If the SEAC glyph doesn't have a (H)SBW of its */
+ /* own use the values from the base glyph. */
- left_bearing = *decoder->builder.left_bearing;
- advance = *decoder->builder.advance;
+ if ( !haveWidth )
+ {
+ left_bearing = *decoder->builder.left_bearing;
+ advance = *decoder->builder.advance;
+ }
decoder->builder.left_bearing->x = 0;
decoder->builder.left_bearing->y = 0;
@@ -1473,8 +1483,8 @@
&dummyWidth );
cf2_freeT1SeacComponent( decoder, &component );
- /* restore the left side bearing and */
- /* advance width of the base character */
+ /* restore the left side bearing and advance width */
+ /* of the SEAC glyph or base character (saved above) */
*decoder->builder.left_bearing = left_bearing;
*decoder->builder.advance = advance;