Synced opentype.c to AAT and more TODOs.
This commit is contained in:
parent
2ffcd192c0
commit
16b0ca518e
|
@ -2,7 +2,8 @@
|
||||||
#include "../ui.h"
|
#include "../ui.h"
|
||||||
#include "uipriv.h"
|
#include "uipriv.h"
|
||||||
|
|
||||||
// note: each tag should only appear in quotes once; this allows automated tools to determine what we cover and don't cover
|
// Notes:
|
||||||
|
// - Each tag should only appear in quotes once; this allows automated tools to determine what we cover and don't cover
|
||||||
|
|
||||||
typedef void (*specToOpenTypeEnumFunc)(const char *featureTag, uint32_t param, void *data);
|
typedef void (*specToOpenTypeEnumFunc)(const char *featureTag, uint32_t param, void *data);
|
||||||
|
|
||||||
|
@ -15,6 +16,15 @@ static void boolspec(uiAttributeSpec *spec, const char *featureTag, specToOpenTy
|
||||||
(*f)(featureTag, 0, data);
|
(*f)(featureTag, 0, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void boolspecnot(uiAttributeSpec *spec, const char *featureTag, specToOpenTypeEnumFunc f, void *data)
|
||||||
|
{
|
||||||
|
if (spec->Value == 0) {
|
||||||
|
(*f)(featureTag, 1, data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
(*f)(featureTag, 0, data);
|
||||||
|
}
|
||||||
|
|
||||||
void specToOpenType(uiAttributeSpec *spec, specToOpenTypeEnumFunc f, void *data)
|
void specToOpenType(uiAttributeSpec *spec, specToOpenTypeEnumFunc f, void *data)
|
||||||
{
|
{
|
||||||
switch (spec->Type) {
|
switch (spec->Type) {
|
||||||
|
@ -32,11 +42,25 @@ void specToOpenType(uiAttributeSpec *spec, specToOpenTypeEnumFunc f, void *data)
|
||||||
return;
|
return;
|
||||||
case uiAttributeHistoricalLigatures:
|
case uiAttributeHistoricalLigatures:
|
||||||
boolspec(spec, "hlig", f, data);
|
boolspec(spec, "hlig", f, data);
|
||||||
|
// This technically isn't what is meant by "historical ligatures", but Core Text's internal AAT-to-OpenType mapping says to include it, so we include it too
|
||||||
|
boolspec(spec, "hist", f, data);
|
||||||
return;
|
return;
|
||||||
case uiAttributeUnicase:
|
case uiAttributeUnicase:
|
||||||
boolspec(spec, "unic", f, data);
|
boolspec(spec, "unic", f, data);
|
||||||
return;
|
return;
|
||||||
// TODO is this correct or should we explicitly switch the rest off too?
|
// TODO is this correct or should we explicitly switch the rest off too?
|
||||||
|
case uiAttributeNumberSpacings:
|
||||||
|
// TODO does Core Text set both? do we?
|
||||||
|
switch (spec->Value) {
|
||||||
|
case uiAttributeNumberSpacingProportional:
|
||||||
|
(*f)("pnum", 1, data);
|
||||||
|
break;
|
||||||
|
case uiAttributeNumberSpacingTitling:
|
||||||
|
(*f)("tnum", 1, data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
// TODO is this correct or should we explicitly switch the rest off too?
|
||||||
case uiAttributeSuperscripts:
|
case uiAttributeSuperscripts:
|
||||||
switch (spec->Value) {
|
switch (spec->Value) {
|
||||||
case uiAttributeSuperscriptSuperscript:
|
case uiAttributeSuperscriptSuperscript:
|
||||||
|
@ -73,6 +97,9 @@ void specToOpenType(uiAttributeSpec *spec, specToOpenTypeEnumFunc f, void *data)
|
||||||
case uiAttributeOrnamentalForms:
|
case uiAttributeOrnamentalForms:
|
||||||
(*f)("ornm", (uint32_t) (spec->Value), data);
|
(*f)("ornm", (uint32_t) (spec->Value), data);
|
||||||
return;
|
return;
|
||||||
|
case uiAttributeSpecificCharacterForm:
|
||||||
|
(*f)("aalt", (uint32_t) (spec->Value), data);
|
||||||
|
return;
|
||||||
case uiAttributeTitlingCapitalForms:
|
case uiAttributeTitlingCapitalForms:
|
||||||
boolspec(spec, "titl", data);
|
boolspec(spec, "titl", data);
|
||||||
return;
|
return;
|
||||||
|
@ -113,6 +140,12 @@ void specToOpenType(uiAttributeSpec *spec, specToOpenTypeEnumFunc f, void *data)
|
||||||
return;
|
return;
|
||||||
case uiAttributeLowercaseNumbers:
|
case uiAttributeLowercaseNumbers:
|
||||||
boolspec(spec, "onum", data);
|
boolspec(spec, "onum", data);
|
||||||
|
// Core Text's internal AAT-to-OpenType mapping says to include this, so we include it too
|
||||||
|
// TODO is it always set?
|
||||||
|
boolspecnot(spec, "lnum", data);
|
||||||
|
return;
|
||||||
|
case uiAttributeHanjaToHangul:
|
||||||
|
boolspec(spec, "hngl", data);
|
||||||
return;
|
return;
|
||||||
case uiAttributeGlyphAnnotations:
|
case uiAttributeGlyphAnnotations:
|
||||||
(*f)("nalt", (uint32_t) (spec->Value), data);
|
(*f)("nalt", (uint32_t) (spec->Value), data);
|
||||||
|
@ -225,3 +258,26 @@ void specToOpenType(uiAttributeSpec *spec, specToOpenTypeEnumFunc f, void *data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO missing that AAT uses directly:
|
||||||
|
// - pkna, pwid, fwid, hwid, twid, qwid, palt, valt, vpal, halt, vhal, kern, vkrn (CJK width control)
|
||||||
|
// - ruby
|
||||||
|
// missing that AAT knows about:
|
||||||
|
// - abvf, abvm, abvs, blwf, blwm, blws (baselines)
|
||||||
|
// - akhn, dist, half, haln, nukt, rkrf, rphf, vatu (Devanagari support)
|
||||||
|
// - ccmp (compositions)
|
||||||
|
// - cjct, pres, pstf, psts (Indic script support)
|
||||||
|
// - curs (cursive positioning)
|
||||||
|
// - dnom, numr (fraction parts)
|
||||||
|
// - falt, fina, init, isol, jalt, medi, mset (Arabic support)
|
||||||
|
// - rclt (required contextual alternates)
|
||||||
|
// - fin2, fin3, med2 (Syriac script support)
|
||||||
|
// - lfbd, opbd, rtbd (optical bounds support)
|
||||||
|
// - ljmo, tjmo, vjmo (Hangul Jamo support)
|
||||||
|
// - locl (Cyrillic support)
|
||||||
|
// - ltra, ltrm, rtla, rtlm (bidi support)
|
||||||
|
// - mark, mkmk (mark positioning)
|
||||||
|
// - pref (Khmer support)
|
||||||
|
// - rand (random glyph selection candidates)
|
||||||
|
// - salt (stylistic alternatives)
|
||||||
|
// - size (sizing info)
|
||||||
|
|
25
ui_attrstr.h
25
ui_attrstr.h
|
@ -76,11 +76,8 @@ _UI_ENUM(uiAttribute) {
|
||||||
|
|
||||||
// TODO uiAttributeLinguisticRearrangement, // 0 = off, 1 = on
|
// TODO uiAttributeLinguisticRearrangement, // 0 = off, 1 = on
|
||||||
|
|
||||||
// AAT: if off, "monospaced number spacing"; if on, "proportional number spacing"
|
// TODO rename this
|
||||||
// OpenType: non-proportional numbers are called "tabular"
|
uiAttributeNumberSpacings, // enum uiAttributeNumberSpacing
|
||||||
// TODO uiAttributeProportionalNumbers, // 0 = off, 1 = on
|
|
||||||
// TODO kNumberSpacingType 0 or 1
|
|
||||||
// TODO really?
|
|
||||||
|
|
||||||
// TODO kSmartSwashType
|
// TODO kSmartSwashType
|
||||||
|
|
||||||
|
@ -106,7 +103,13 @@ _UI_ENUM(uiAttribute) {
|
||||||
uiAttributeOrnamentalForms, // an integer from 0 to a font-specified upper bound
|
uiAttributeOrnamentalForms, // an integer from 0 to a font-specified upper bound
|
||||||
// TODO provide a function to get the upper bound?
|
// TODO provide a function to get the upper bound?
|
||||||
|
|
||||||
// TODO kCharacterAlternativesType
|
// AAT calls this "character alternatives" and defines the
|
||||||
|
// following values:
|
||||||
|
// 0 = none
|
||||||
|
// OpenType calls this "access all alternates".
|
||||||
|
// TODO doesn't OpenType do the same about 0?
|
||||||
|
uiAttributeSpecificCharacterForm, // an integer from 0 to a font-specified upper bound
|
||||||
|
// TODO provide a function to get the upper bound?
|
||||||
|
|
||||||
uiAttributeTitlingCapitalForms, // 0 = off, 1 = on
|
uiAttributeTitlingCapitalForms, // 0 = off, 1 = on
|
||||||
|
|
||||||
|
@ -119,7 +122,7 @@ _UI_ENUM(uiAttribute) {
|
||||||
// TODO kTextSpacingType
|
// TODO kTextSpacingType
|
||||||
// see kKanaSpacingType below
|
// see kKanaSpacingType below
|
||||||
|
|
||||||
// TODO kTransliterationType
|
uiAttributeHanjaToHangul, // 0 = off, 1 = on
|
||||||
|
|
||||||
// AAT defines the following values:
|
// AAT defines the following values:
|
||||||
// 0 = none
|
// 0 = none
|
||||||
|
@ -139,7 +142,7 @@ _UI_ENUM(uiAttribute) {
|
||||||
|
|
||||||
// TODO kKanaSpacingType
|
// TODO kKanaSpacingType
|
||||||
// TODO kIdeographicSpacingType
|
// TODO kIdeographicSpacingType
|
||||||
// should these be provided? CAN they be provided?
|
// can they be provided independently of kTextSpacingType? Core Text doesn't seem to
|
||||||
|
|
||||||
// TODO kUnicodeDecompositionType
|
// TODO kUnicodeDecompositionType
|
||||||
|
|
||||||
|
@ -211,6 +214,12 @@ _UI_ENUM(uiDrawUnderlineColor) {
|
||||||
uiDrawUnderlineColorAuxiliary, // for instance, the color used by smart replacements on OS X
|
uiDrawUnderlineColorAuxiliary, // for instance, the color used by smart replacements on OS X
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_UI_ENUM(uiAttributeNumberSpacing) {
|
||||||
|
uiAttributeNumberSpacingProportional,
|
||||||
|
// AAT calls this "monospaced"
|
||||||
|
uiAttributeNumberSpacingTabular,
|
||||||
|
};
|
||||||
|
|
||||||
_UI_ENUM(uiAttributeSuperscript) {
|
_UI_ENUM(uiAttributeSuperscript) {
|
||||||
uiAttributeSuperscriptNone,
|
uiAttributeSuperscriptNone,
|
||||||
uiAttributeSuperscriptSuperscript, // AAT: "superior"
|
uiAttributeSuperscriptSuperscript, // AAT: "superior"
|
||||||
|
|
Loading…
Reference in New Issue