Migrated aat.m back.

This commit is contained in:
Pietro Gagliardi 2018-03-04 15:53:46 -05:00
parent 36567cc522
commit d8ad3300c9
4 changed files with 17 additions and 17 deletions

View File

@ -10,17 +10,3 @@ extern void initUnderlineColors(void);
extern void uninitUnderlineColors(void);
typedef void (^backgroundBlock)(uiDrawContext *c, uiDrawTextLayout *layout, double x, double y);
extern CFAttributedStringRef attrstrToCoreFoundation(uiDrawTextLayoutParams *p, NSArray **backgroundBlocks);
// aat.m
typedef void (^aatBlock)(uint16_t type, uint16_t selector);
extern void openTypeToAAT(char a, char b, char c, char d, uint32_t value, aatBlock f);
// opentype.m
// TODO this is only used by opentype.m and aat.m; figure out some better way to handle this
// TODO remove x8tox32()
#define x8tox32(x) ((uint32_t) (((uint8_t) (x)) & 0xFF))
#define mkTag(a, b, c, d) \
((x8tox32(a) << 24) | \
(x8tox32(b) << 16) | \
(x8tox32(c) << 8) | \
x8tox32(d))

View File

@ -1,9 +1,10 @@
// 14 february 2017
#import "uipriv_darwin.h"
#import "attrstr.h"
// TODO explain the purpose of this file
static void boolspec(uint32_t value, uint16_t type, uint16_t ifTrue, uint16_t ifFalse, aatBlock f)
static void boolspec(uint32_t value, uint16_t type, uint16_t ifTrue, uint16_t ifFalse, uiprivAATBlock f)
{
// TODO are values other than 1 accepted for true by OpenType itself? (same for the rest of the file)
if (value != 0) {
@ -13,8 +14,17 @@ static void boolspec(uint32_t value, uint16_t type, uint16_t ifTrue, uint16_t if
f(type, ifFalse);
}
// TODO remove the need for this
// TODO remove x8tox32()
#define x8tox32(x) ((uint32_t) (((uint8_t) (x)) & 0xFF))
#define mkTag(a, b, c, d) \
((x8tox32(a) << 24) | \
(x8tox32(b) << 16) | \
(x8tox32(c) << 8) | \
x8tox32(d))
// TODO double-check drawtext example to make sure all of these are used properly (I already screwed dlig up by putting clig twice instead)
void openTypeToAAT(char a, char b, char c, char d, uint32_t value, aatBlock f)
void uiprivOpenTypeToAAT(char a, char b, char c, char d, uint32_t value, uiprivAATBlock f)
{
switch (mkTag(a, b, c, d)) {
case mkTag('l', 'i', 'g', 'a'):

View File

@ -3,3 +3,7 @@
// opentype.m
extern CFArrayRef uiprivOpenTypeFeaturesToCTFeatures(const uiOpenTypeFeatures *otf);
// aat.m
typedef void (^uiprivAATBlock)(uint16_t type, uint16_t selector);
extern void uiprivOpenTypeToAAT(char a, char b, char c, char d, uint32_t value, uiprivAATBlock f);

View File

@ -53,7 +53,7 @@ static uiForEach otfArrayForEachAAT(const uiOpenTypeFeatures *otf, char a, char
p.array = (CFMutableArrayRef) data;
p.tagIsNumber = YES;
openTypeToAAT(a, b, c, d, value, ^(uint16_t type, uint16_t selector) {
uiprivOpenTypeToAAT(a, b, c, d, value, ^(uint16_t type, uint16_t selector) {
p.tagKey = kCTFontFeatureTypeIdentifierKey;
p.tagType = kCFNumberSInt16Type;
p.tagValue = (const SInt16 *) (&type);