And got rid of the remaining old stuff entirely.

This commit is contained in:
Pietro Gagliardi 2017-05-19 16:14:39 -04:00
parent bd39189a0e
commit 90962e18c4
2 changed files with 0 additions and 483 deletions

View File

@ -1,314 +0,0 @@
// 14 february 2017
#include "../ui.h"
#include "uipriv.h"
// Notes:
// - Each tag should only appear in quotes once (including within comments); this allows automated tools to determine what we cover and don't cover
static void boolspec(uiAttributeSpec *spec, const char *featureTag, specToOpenTypeEnumFunc f, void *data)
{
if (spec->Value != 0) {
(*f)(featureTag, 1, data);
return;
}
(*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)
{
switch (spec->Type) {
case uiAttributeStandardLigatures:
boolspec(spec, "liga", f, data);
return;
case uiAttributeRequiredLigatures:
boolspec(spec, "rlig", f, data);
return;
case uiAttributeDiscretionaryLigatures:
boolspec(spec, "dlig", f, data);
return;
case uiAttributeContextualLigatures:
boolspec(spec, "clig", f, data);
return;
case uiAttributeHistoricalLigatures:
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;
case uiAttributeUnicase:
boolspec(spec, "unic", f, data);
return;
// 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 uiAttributeNumberSpacingTabular:
(*f)("tnum", 1, data);
break;
}
return;
case uiAttributeSuperscripts:
switch (spec->Value) {
case uiAttributeSuperscriptSuperscript:
(*f)("sups", 1, data);
break;
case uiAttributeSuperscriptSubscript:
(*f)("subs", 1, data);
break;
case uiAttributeSuperscriptOrdinal:
(*f)("ordn", 1, data);
break;
case uiAttributeSuperscriptScientificInferior:
(*f)("sinf", 1, data);
break;
}
return;
// TODO is this correct or should we explicitly switch the rest off too?
case uiAttributeFractionForms:
switch (spec->Value) {
case uiAttributeFractionFormVertical:
(*f)("afrc", 1, data);
break;
case uiAttributeFractionFormDiagonal:
(*f)("frac", 1, data);
break;
}
return;
case uiAttributeSlashedZero:
boolspec(spec, "zero", f, data);
return;
case uiAttributeMathematicalGreek:
boolspec(spec, "mgrk", f, data);
return;
case uiAttributeOrnamentalForms:
(*f)("ornm", (uint32_t) (spec->Value), data);
return;
case uiAttributeSpecificCharacterForm:
(*f)("aalt", (uint32_t) (spec->Value), data);
return;
case uiAttributeTitlingCapitalForms:
boolspec(spec, "titl", f, data);
return;
// TODO is this correct or should we explicitly switch the rest off too?
case uiAttributeHanCharacterForms:
switch (spec->Value) {
case uiAttributeHanCharacterFormTraditional:
(*f)("trad", 1, data);
break;
case uiAttributeHanCharacterFormSimplified:
(*f)("smpl", 1, data);
break;
case uiAttributeHanCharacterFormJIS1978:
(*f)("jp78", 1, data);
break;
case uiAttributeHanCharacterFormJIS1983:
(*f)("jp83", 1, data);
break;
case uiAttributeHanCharacterFormJIS1990:
(*f)("jp90", 1, data);
break;
case uiAttributeHanCharacterFormExpert:
(*f)("expt", 1, data);
break;
case uiAttributeHanCharacterFormJIS2004:
(*f)("jp04", 1, data);
break;
case uiAttributeHanCharacterFormHojo:
(*f)("hojo", 1, data);
break;
case uiAttributeHanCharacterFormNLC:
(*f)("nlck", 1, data);
break;
case uiAttributeHanCharacterFormTraditionalNames:
(*f)("tnam", 1, data);
break;
}
return;
case uiAttributeLowercaseNumbers:
boolspec(spec, "onum", f, 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", f, data);
return;
case uiAttributeHanjaToHangul:
boolspec(spec, "hngl", f, data);
return;
case uiAttributeAnnotatedGlyphForms:
(*f)("nalt", (uint32_t) (spec->Value), data);
return;
case uiAttributeRubyKanaForms:
boolspec(spec, "ruby", f, data);
return;
case uiAttributeCJKRomansToItalics:
boolspec(spec, "ital", f, data);
return;
case uiAttributeCaseSensitiveForms:
boolspec(spec, "case", f, data);
return;
case uiAttributeCapitalSpacing:
boolspec(spec, "cpsp", f, data);
return;
case uiAttributeAlternateHorizontalKana:
boolspec(spec, "hkna", f, data);
return;
case uiAttributeAlternateVerticalKana:
boolspec(spec, "vkna", f, data);
return;
case uiAttributeStylisticAlternate1:
boolspec(spec, "ss01", f, data);
return;
case uiAttributeStylisticAlternate2:
boolspec(spec, "ss02", f, data);
return;
case uiAttributeStylisticAlternate3:
boolspec(spec, "ss03", f, data);
return;
case uiAttributeStylisticAlternate4:
boolspec(spec, "ss04", f, data);
return;
case uiAttributeStylisticAlternate5:
boolspec(spec, "ss05", f, data);
return;
case uiAttributeStylisticAlternate6:
boolspec(spec, "ss06", f, data);
return;
case uiAttributeStylisticAlternate7:
boolspec(spec, "ss07", f, data);
return;
case uiAttributeStylisticAlternate8:
boolspec(spec, "ss08", f, data);
return;
case uiAttributeStylisticAlternate9:
boolspec(spec, "ss09", f, data);
return;
case uiAttributeStylisticAlternate10:
boolspec(spec, "ss10", f, data);
return;
case uiAttributeStylisticAlternate11:
boolspec(spec, "ss11", f, data);
return;
case uiAttributeStylisticAlternate12:
boolspec(spec, "ss12", f, data);
return;
case uiAttributeStylisticAlternate13:
boolspec(spec, "ss13", f, data);
return;
case uiAttributeStylisticAlternate14:
boolspec(spec, "ss14", f, data);
return;
case uiAttributeStylisticAlternate15:
boolspec(spec, "ss15", f, data);
return;
case uiAttributeStylisticAlternate16:
boolspec(spec, "ss16", f, data);
return;
case uiAttributeStylisticAlternate17:
boolspec(spec, "ss17", f, data);
return;
case uiAttributeStylisticAlternate18:
boolspec(spec, "ss18", f, data);
return;
case uiAttributeStylisticAlternate19:
boolspec(spec, "ss19", f, data);
return;
case uiAttributeStylisticAlternate20:
boolspec(spec, "ss20", f, data);
return;
case uiAttributeContextualAlternates:
boolspec(spec, "calt", f, data);
return;
case uiAttributeSwashes:
boolspec(spec, "swsh", f, data);
return;
case uiAttributeContextualSwashes:
boolspec(spec, "cswh", f, data);
return;
// TODO is this correct or should we explicitly switch the rest off too?
case uiAttributeLowercaseCapForms:
switch (spec->Value) {
case uiAttributeCapFormSmallCaps:
(*f)("smcp", 1, data);
break;
case uiAttributeCapFormPetiteCaps:
(*f)("pcap", 1, data);
break;
}
return;
// TODO is this correct or should we explicitly switch the rest off too?
case uiAttributeUppercaseCapForms:
switch (spec->Value) {
case uiAttributeCapFormSmallCaps:
(*f)("c2sc", 1, data);
break;
case uiAttributeCapFormPetiteCaps:
(*f)("c2pc", 1, data);
break;
}
return;
}
}
// TODO missing that AAT uses directly:
// - pkna, pwid, fwid, hwid, twid, qwid, palt, valt, vpal, halt, vhal, kern, vkrn (CJK width control)
// missing that AAT knows about:
// - ccmp (compositions)
// - dnom, numr (fraction parts) — no AAT equivalent...
// - falt, jalt (Arabic support)
// - rclt (required contextual alternates)
// - lfbd, opbd, rtbd (optical bounds support)
// - locl (Cyrillic support)
// - ltra, ltrm, rtla, rtlm (bidi support)
// - mark, mkmk (mark positioning)
// - rand (random glyph selection candidates)
// - salt (stylistic alternatives)
// - size (sizing info)
//
// script-specific; core text and pango/harfbuzz use these automatically based on the language
// TODO if DirectWrite does too we can ignore them and just provide a language attribute (they all use BCP 47 syntax for language names)
// Tag Core Text? Harfbuzz?
// abvf yes yes
// abvm yes yes
// abvs yes TODO
// akhn yes yes
// blwf yes yes
// blwm yes yes
// blws yes TODO
// cjct yes yes
// curs yes yes
// dist yes yes
// falt TODO TODO
// fin2 yes yes
// fin3 yes yes
// fina yes yes
// half yes yes
// haln yes yes
// init yes yes
// isol yes yes
// jalt TODO TODO
// ljmo yes yes
// locl TODO all horz(!)
// med2 yes yes
// medi yes yes
// mset TODO yes
// nukt yes yes
// pref yes yes
// pres yes yes
// pstf yes yes
// psts yes yes
// rclt TODO all horz(!)
// rkrf yes yes
// rphf yes yes
// tjmo yes yes
// vatu yes yes
// vjmo yes yes

View File

@ -34,132 +34,6 @@ _UI_ENUM(uiAttribute) {
// TODO note that for the purpose of uiAttributedString two sets of features are only the same (and thus their attributes are merged) only if the pointers are the same; whether the tag sets are the same only become relevant to uiDrawTextLayout // TODO note that for the purpose of uiAttributedString two sets of features are only the same (and thus their attributes are merged) only if the pointers are the same; whether the tag sets are the same only become relevant to uiDrawTextLayout
uiAttributeFeatures, // object of type uiOpenTypeFeatures uiAttributeFeatures, // object of type uiOpenTypeFeatures
#if 0
// These attributes represent typographic features. Each feature
// is a separate attribute, to make composition easier. The
// availability of for each attribute are defined by the font; the
// default values are defined by the font and/or by the OS.
//
// A note about features whose parameter is an enumeration:
// OS X defines typographic features using the AAT specification
// and converts to OpenType internally when needed, whereas
// other platforms use OpenType directly. OpenType is less
// precise about what each enumeration value means than AAT
// is, so enumeration values do not necessarily represent what
// OS X expects with all fonts. In cases where they do, libui
// provides an enumeration type to use. Otherwise, the AAT
// enumeration values are provided in comments for
// documentation purposes.
// AAT calls these "common ligatures"
uiAttributeStandardLigatures, // 0 = off, 1 = on
uiAttributeRequiredLigatures, // 0 = off, 1 = on
// AAT calls these "rare ligatures"
uiAttributeDiscretionaryLigatures, // 0 = off, 1 = on
uiAttributeContextualLigatures, // 0 = off, 1 = on
uiAttributeHistoricalLigatures, // 0 = off, 1 = on
uiAttributeUnicase, // 0 = off, 1 = on
// TODO rename this
uiAttributeNumberSpacings, // enum uiAttributeNumberSpacing
uiAttributeSuperscripts, // enum uiAttributeSuperscript
uiAttributeFractionForms, // enum uiAttributeFractionForm
uiAttributeSlashedZero, // 0 = off, 1 = on
uiAttributeMathematicalGreek, // 0 = off, 1 = on
// AAT defines the following values:
// 0 = none
// 1 = dingbats
// 2 = pi characters
// 3 = fleurons
// 4 = decorative borders
// 5 = international symbols
// 6 = mathematical symbols
// OpenType says alphanumeric characters must(? TODO) have one form each and the bullet character U+2022 (•) can have many
uiAttributeOrnamentalForms, // an integer from 0 to a font-specified upper bound
// TODO provide a function to get the upper bound?
// AAT calls this "character alternatives" and defines the
// following values:
// 0 = none
// OpenType calls this "access all alternates".
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
// AAT calls these "character shapes"
uiAttributeHanCharacterForms, // enum uiAttributeHanCharacterForm
// OpenType calls these "old-style"
uiAttributeLowercaseNumbers, // 0 = off, 1 = on
uiAttributeHanjaToHangul, // 0 = off, 1 = on
// AAT defines the following values:
// 0 = none
// 1 = box
// 2 = rounded box
// 3 = circle
// 4 = inverted circle
// 5 = parentheses
// 6 = period
// 7 = roman numeral
// 8 = diamond
// 9 = inverted box
// 10 = inverted rounded box
uiAttributeAnnotatedGlyphForms, // an integer from 0 to a font-specified upper bound
// TODO provide a function to get the upper bound?
uiAttributeRubyKanaForms, // 0 = off, 1 = on
uiAttributeCJKRomansToItalics, // 0 = off, 1 = on
// AAT calls this "case-sensitive layout"
uiAttributeCaseSensitiveForms, // 0 = off, 1 = on
// AAT: this is called "case-sensitive spacing"
uiAttributeCapitalSpacing, // 0 = off, 1 = on
uiAttributeAlternateHorizontalKana, // 0 = off, 1 = on
uiAttributeAlternateVerticalKana, // 0 = off, 1 = on
// TODO document that these are guaranteed to be consecutive
uiAttributeStylisticAlternate1, // 0 = off, 1 = on
uiAttributeStylisticAlternate2, // 0 = off, 1 = on
uiAttributeStylisticAlternate3, // 0 = off, 1 = on
uiAttributeStylisticAlternate4, // 0 = off, 1 = on
uiAttributeStylisticAlternate5, // 0 = off, 1 = on
uiAttributeStylisticAlternate6, // 0 = off, 1 = on
uiAttributeStylisticAlternate7, // 0 = off, 1 = on
uiAttributeStylisticAlternate8, // 0 = off, 1 = on
uiAttributeStylisticAlternate9, // 0 = off, 1 = on
uiAttributeStylisticAlternate10, // 0 = off, 1 = on
uiAttributeStylisticAlternate11, // 0 = off, 1 = on
uiAttributeStylisticAlternate12, // 0 = off, 1 = on
uiAttributeStylisticAlternate13, // 0 = off, 1 = on
uiAttributeStylisticAlternate14, // 0 = off, 1 = on
uiAttributeStylisticAlternate15, // 0 = off, 1 = on
uiAttributeStylisticAlternate16, // 0 = off, 1 = on
uiAttributeStylisticAlternate17, // 0 = off, 1 = on
uiAttributeStylisticAlternate18, // 0 = off, 1 = on
uiAttributeStylisticAlternate19, // 0 = off, 1 = on
uiAttributeStylisticAlternate20, // 0 = off, 1 = on
uiAttributeContextualAlternates, // 0 = off, 1 = on
uiAttributeSwashes, // 0 = off, 1 = on
uiAttributeContextualSwashes, // 0 = off, 1 = on
uiAttributeLowercaseCapForms, // enum uiAttributeCapForm
uiAttributeUppercaseCapForms, // enum uiAttributeCapForm
};
#endif
}; };
_UI_ENUM(uiDrawUnderlineStyle) { _UI_ENUM(uiDrawUnderlineStyle) {
@ -176,49 +50,6 @@ _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
}; };
#if 0
_UI_ENUM(uiAttributeNumberSpacing) {
uiAttributeNumberSpacingProportional,
// AAT calls this "monospaced"
uiAttributeNumberSpacingTabular,
};
_UI_ENUM(uiAttributeSuperscript) {
uiAttributeSuperscriptNone,
uiAttributeSuperscriptSuperscript, // AAT: "superior"
uiAttributeSuperscriptSubscript, // AAT: "inferior"
uiAttributeSuperscriptOrdinal,
uiAttributeSuperscriptScientificInferior,
};
_UI_ENUM(uiAttributeFractionForm) {
uiAttributeFractionFormNone,
uiAttributeFractionFormVertical,
uiAttributeFractionFormDiagonal,
};
_UI_ENUM(uiAttributeHanCharacterForm) {
uiAttributeHanCharacterFormTraditional,
uiAttributeHanCharacterFormSimplified,
uiAttributeHanCharacterFormJIS1978,
uiAttributeHanCharacterFormJIS1983,
uiAttributeHanCharacterFormJIS1990,
uiAttributeHanCharacterFormExpert,
uiAttributeHanCharacterFormJIS2004,
uiAttributeHanCharacterFormHojo,
uiAttributeHanCharacterFormNLC,
uiAttributeHanCharacterFormTraditionalNames,
};
_UI_ENUM(uiAttributeCapForm) {
uiAttributeCapFormNormal,
uiAttributeCapFormSmallCaps,
uiAttributeCapFormPetiteCaps,
};
#endif
// TODO rename? // TODO rename?
typedef struct uiOpenTypeFeatures uiOpenTypeFeatures; typedef struct uiOpenTypeFeatures uiOpenTypeFeatures;
// TODO pass the feature set? // TODO pass the feature set?