More stuff. I should probably write that OpenType features test now.
This commit is contained in:
parent
d63a5b23b1
commit
f0813ac6e4
|
@ -372,6 +372,8 @@ static void applyAndFreeFontAttributes(struct foreachParams *p)
|
|||
font = defaultFont;
|
||||
CFRetain(font);
|
||||
} else
|
||||
// note that this handles the difference between NULL and empty uiOpenTypeFeatures properly as far as conversion to native data formats is concerned (NULL does not generate a features dictionary; empty just produces an empty one)
|
||||
// TODO but what about from the OS's perspective on all OSs?
|
||||
font = [cfa toCTFont];
|
||||
CFAttributedStringSetAttribute(p->mas, range, kCTFontAttributeName, font);
|
||||
CFRelease(font);
|
||||
|
|
|
@ -92,7 +92,7 @@ _UI_ENUM(uiDrawUnderlineColor) {
|
|||
// a glyph shape to use.
|
||||
//
|
||||
// If a font does not support a certain feature, that feature will be
|
||||
// ignored.
|
||||
// ignored. (TODO verify this on all OSs)
|
||||
//
|
||||
// See the OpenType specification at
|
||||
// https://www.microsoft.com/typography/otspec/featuretags.htm
|
||||
|
|
|
@ -154,7 +154,10 @@ static uiForEach processAttribute(uiAttributedString *s, uiAttributeSpec *spec,
|
|||
}
|
||||
break;
|
||||
case uiAttributeFeatures:
|
||||
// TODO make sure NULLs are handled properly on all platforms in this part of the code
|
||||
// only generate an attribute if spec->Features is not NULL
|
||||
// TODO state that this is allowed
|
||||
if (spec->Features == NULL)
|
||||
break;
|
||||
featurestr = otfToPangoCSSString(spec->Features);
|
||||
addattr(p, start, end,
|
||||
FUTURE_pango_attr_font_features_new(featurestr));
|
||||
|
|
|
@ -174,7 +174,9 @@ static uiForEach processAttribute(uiAttributedString *s, uiAttributeSpec *spec,
|
|||
}
|
||||
break;
|
||||
case uiAttributeFeatures:
|
||||
// TODO make sure this behaves properly if spec->Features is NULL
|
||||
// only generate an attribute if spec->Features is not NULL
|
||||
if (spec->Features == NULL)
|
||||
break;
|
||||
dt = otfToDirectWrite(spec->Features);
|
||||
hr = p->layout->SetTypography(dt, range);
|
||||
if (hr != S_OK)
|
||||
|
|
Loading…
Reference in New Issue