Started fixing compile errors. I forgot I renamed uiDrawFontDescriptor to uiFontDescriptor!

This commit is contained in:
Pietro Gagliardi 2018-03-08 23:04:45 -05:00
parent 9661d14262
commit e9a62461c2
8 changed files with 29 additions and 29 deletions

View File

@ -206,7 +206,7 @@ uiAttribute *uiNewUnderlineColorAttribute(uiUnderlineColor u, double r, double g
return at;
}
void uiAttributeUnderline(const uiAttribute *a, uiUnderlineColor *u, double *r, double *g, double *b, double *alpha)
void uiAttributeUnderlineColor(const uiAttribute *a, uiUnderlineColor *u, double *r, double *g, double *b, double *alpha)
{
*u = a->u.color.underlineColor;
uiAttributeColor(a, r, g, b, alpha);

View File

@ -60,16 +60,16 @@ extern void uiprivOpenTypeToAAT(char a, char b, char c, char d, uint32_t value,
- (CFStringRef)familyName;
- (CFArrayRef)variationAxes;
@end
extern CTFontDescriptorRef uiprivDrawFontDescriptorToCTFontDescriptor(uiDrawFontDescriptor *fd);
extern CTFontDescriptorRef uiprivFontDescriptorToCTFontDescriptor(uiFontDescriptor *fd);
extern CTFontDescriptorRef uiprivCTFontDescriptorAppendFeatures(CTFontDescriptorRef desc, const uiOpenTypeFeatures *otf);
extern void uiprivDrawFontDescriptorFromCTFontDescriptor(CTFontDescriptorRef ctdesc, uiDrawFontDescriptor *uidesc);
extern void uiprivFontDescriptorFromCTFontDescriptor(CTFontDescriptorRef ctdesc, uiFontDescriptor *uidesc);
// fonttraits.m
extern void uiprivProcessFontTraits(uiprivFontStyleData *d, uiDrawFontDescriptor *out);
extern void uiprivProcessFontTraits(uiprivFontStyleData *d, uiFontDescriptor *out);
// fontvariation.m
extern NSDictionary *uiprivMakeVariationAxisDict(CFArrayRef axes, CFDataRef avarTable);
extern void uiprivProcessFontVariation(uiprivFontStyleData *d, NSDictionary *axisDict, uiDrawFontDescriptor *out);
extern void uiprivProcessFontVariation(uiprivFontStyleData *d, NSDictionary *axisDict, uiFontDescriptor *out);
// attrstr.m
extern void uiprivInitUnderlineColors(void);

View File

@ -58,7 +58,7 @@ void uiprivUninitUnderlineColors(void)
spellingColor = nil;
}
// TODO opentype features are lost when using uiDrawFontDescriptor, so a handful of fonts in the font panel ("Titling" variants of some fonts and possibly others but those are the examples I know about) cannot be represented by uiDrawFontDescriptor; what *can* we do about this since this info is NOT part of the font on other platforms?
// TODO opentype features are lost when using uiFontDescriptor, so a handful of fonts in the font panel ("Titling" variants of some fonts and possibly others but those are the examples I know about) cannot be represented by uiFontDescriptor; what *can* we do about this since this info is NOT part of the font on other platforms?
// TODO see if we could use NSAttributedString?
// TODO consider renaming this struct and the fep variable(s)
// TODO restructure all this so the important details at the top are below with the combined font attributes type?
@ -115,7 +115,7 @@ static uiForEach featuresHash(const uiOpenTypeFeatures *otf, char a, char b, cha
NSUInteger hash;
}
- (void)addAttribute:(uiAttribute *)attr;
- (CTFontRef)toCTFontWithDefaultFont:(uiDrawFontDescriptor *)defaultFont;
- (CTFontRef)toCTFontWithDefaultFont:(uiFontDescriptor *)defaultFont;
@end
@implementation uiprivCombinedFontAttr
@ -216,15 +216,15 @@ static uiForEach featuresHash(const uiOpenTypeFeatures *otf, char a, char b, cha
return self->hash;
}
- (CTFontRef)toCTFontWithDefaultFont:(uiDrawFontDescriptor *)defaultFont
- (CTFontRef)toCTFontWithDefaultFont:(uiFontDescriptor *)defaultFont
{
uiDrawFontDescriptor uidesc;
uiFontDescriptor uidesc;
CTFontDescriptorRef desc;
CTFontRef font;
uidesc = *defaultFont;
if (self->attrs[cFamily] != NULL)
// TODO const-correct uiDrawFontDescriptor or change this function below
// TODO const-correct uiFontDescriptor or change this function below
uidesc.Family = (char *) uiAttributeFamily(self->attrs[cFamily]);
if (self->attrs[cSize] != NULL)
uidesc.Size = uiAttributeSize(self->attrs[cSize]);
@ -234,7 +234,7 @@ static uiForEach featuresHash(const uiOpenTypeFeatures *otf, char a, char b, cha
uidesc.Italic = uiAttributeItalic(self->attrs[cItalic]);
if (self->attrs[cStretch] != NULL)
uidesc.Stretch = uiAttributeStretch(self->attrs[cStretch]);
desc = uiprivDrawFontDescriptorToCTFontDescriptor(&uidesc);
desc = uiprivFontDescriptorToCTFontDescriptor(&uidesc);
if (self->attrs[cFeatures] != NULL)
desc = uiprivCTFontDescriptorAppendFeatures(desc, uiAttributeFeatures(self->attrs[cFeatures]));
font = CTFontCreateWithFontDescriptor(desc, uidesc.Size, NULL);
@ -386,7 +386,7 @@ $$TODO_CONTINUE_HERE
return uiForEachContinue;
}
static void applyFontAttributes(CFMutableAttributedStringRef mas, uiDrawFontDescriptor *defaultFont)
static void applyFontAttributes(CFMutableAttributedStringRef mas, uiFontDescriptor *defaultFont)
{
uiprivCombinedFontAttr *cfa;
CTFontRef font;

View File

@ -12,7 +12,7 @@
- (void)activateFontButton;
- (void)deactivateFontButton:(BOOL)activatingAnother;
- (void)deactivateOnClose:(NSNotification *)note;
- (void)getfontdesc:(uiDrawFontDescriptor *)uidesc;
- (void)getfontdesc:(uiFontDescriptor *)uidesc;
@end
// only one may be active at one time
@ -139,14 +139,14 @@ struct uiFontButton {
NSFontPanelCollectionModeMask;
}
- (void)getfontdesc:(uiDrawFontDescriptor *)uidesc
- (void)getfontdesc:(uiFontDescriptor *)uidesc
{
CTFontRef ctfont;
CTFontDescriptorRef ctdesc;
ctfont = (CTFontRef) (self->libui_font);
ctdesc = CTFontCopyFontDescriptor(ctfont);
uiprivDrawFontDescriptorFromCTFontDescriptor(ctdesc, uidesc);
uiprivFontDescriptorFromCTFontDescriptor(ctdesc, uidesc);
CFRelease(ctdesc);
uidesc->Size = CTFontGetSize(ctfont);
}
@ -200,7 +200,7 @@ static void defaultOnChanged(uiFontButton *b, void *data)
// do nothing
}
void uiFontButtonFont(uiFontButton *b, uiDrawFontDescriptor *desc)
void uiFontButtonFont(uiFontButton *b, uiFontDescriptor *desc)
{
[b->button getfontdesc:desc];
}

View File

@ -18,7 +18,7 @@
//
// To make things easier for us, we'll match by converting Core
// Text's values back into libui values. This allows us to also use the
// normalization code for filling in uiDrawFontDescriptors from
// normalization code for filling in uiFontDescriptors from
// Core Text fonts and font descriptors.
//
// Style matching needs to be done early in the font loading process;
@ -318,14 +318,14 @@ static uiDrawTextItalic guessItalicOblique(uiprivFontStyleData *d)
// However, Core Text does seem to guarantee (from experimentation; see below) that the slant will be nonzero if and only if the italic bit is set, so we don't need to use the slant value.
// Core Text also seems to guarantee that if a font lists itself as Italic or Oblique by name (font subfamily name, font style name, whatever), it will also have that bit set, so testing this bit does cover all fonts that name themselves as Italic and Oblique. (Again, this is from the below experimentation.)
// TODO there is still one catch that might matter from a user's POV: the reverse is not true the italic bit can be set even if the style of the font face/subfamily/style isn't named as Italic (for example, script typefaces like Adobe's Palace Script MT Std); I don't know what to do about this... I know how to start: find a script font that has an italic form (Adobe's Palace Script MT Std does not; only Regular and Semibold)
static void setItalic(uiprivFontStyleData *d, uiDrawFontDescriptor *out)
static void setItalic(uiprivFontStyleData *d, uiFontDescriptor *out)
{
out->Italic = uiDrawTextItalicNormal;
if (([d symbolicTraits] & kCTFontItalicTrait) != 0)
out->Italic = guessItalicOblique(d);
}
static void fillDescStyleFields(uiprivFontStyleData *d, NSDictionary *axisDict, uiDrawFontDescriptor *out)
static void fillDescStyleFields(uiprivFontStyleData *d, NSDictionary *axisDict, uiFontDescriptor *out)
{
setItalic(d, out);
if (axisDict != nil)
@ -334,7 +334,7 @@ static void fillDescStyleFields(uiprivFontStyleData *d, NSDictionary *axisDict,
uiprivProcessFontTraits(d, out);
}
static CTFontDescriptorRef matchStyle(CTFontDescriptorRef against, uiDrawFontDescriptor *styles)
static CTFontDescriptorRef matchStyle(CTFontDescriptorRef against, uiFontDescriptor *styles)
{
CFArrayRef matching;
CFIndex i, n;
@ -363,7 +363,7 @@ static CTFontDescriptorRef matchStyle(CTFontDescriptorRef against, uiDrawFontDes
closeness = (struct closeness *) uiAlloc(n * sizeof (struct closeness), "struct closeness[]");
for (i = 0; i < n; i++) {
uiDrawFontDescriptor fields;
uiFontDescriptor fields;
closeness[i].index = i;
if (i != 0) {
@ -413,7 +413,7 @@ static CTFontDescriptorRef matchStyle(CTFontDescriptorRef against, uiDrawFontDes
return out;
}
CTFontDescriptorRef uiprivDrawFontDescriptorToCTFontDescriptor(uiDrawFontDescriptor *fd)
CTFontDescriptorRef uiprivFontDescriptorToCTFontDescriptor(uiFontDescriptor *fd)
{
CFMutableDictionaryRef attrs;
CFStringRef cffamily;
@ -465,7 +465,7 @@ CTFontDescriptorRef uiprivCTFontDescriptorAppendFeatures(CTFontDescriptorRef des
return new;
}
void uiprivDrawFontDescriptorFromCTFontDescriptor(CTFontDescriptorRef ctdesc, uiDrawFontDescriptor *uidesc)
void uiprivFontDescriptorFromCTFontDescriptor(CTFontDescriptorRef ctdesc, uiFontDescriptor *uidesc)
{
CFStringRef cffamily;
uiprivFontStyleData *d;

View File

@ -54,7 +54,7 @@ static const CFStringRef exceptions[] = {
NULL,
};
static void trySecondaryOS2Values(uiprivFontStyleData *d, uiDrawFontDescriptor *out, BOOL *hasWeight, BOOL *hasWidth)
static void trySecondaryOS2Values(uiprivFontStyleData *d, uiFontDescriptor *out, BOOL *hasWeight, BOOL *hasWidth)
{
CFDataRef os2;
uint16_t usWeightClass, usWidthClass;
@ -159,7 +159,7 @@ static BOOL shouldReallyBeSemiCondensed(uiprivFontStyleData *d)
return testTTFOTFSubfamilyNames(d, CFSTR("Semi Condensed"));
}
void uiprivProcessFontTraits(uiprivFontStyleData *d, uiDrawFontDescriptor *out)
void uiprivProcessFontTraits(uiprivFontStyleData *d, uiFontDescriptor *out)
{
double weight, width;
BOOL hasWeight, hasWidth;

View File

@ -305,7 +305,7 @@ static BOOL tryAxis(NSDictionary *axisDict, CFDictionaryRef var, NSNumber *key,
return YES;
}
void uiprivProcessFontVariation(uiprivFontStyleData *d, NSDictionary *axisDict, uiDrawFontDescriptor *out)
void uiprivProcessFontVariation(uiprivFontStyleData *d, NSDictionary *axisDict, uiFontDescriptor *out)
{
CFDictionaryRef var;
double v;

View File

@ -214,7 +214,7 @@ _UI_EXTERN uiAttribute *uiNewUnderlineColorAttribute(uiUnderlineColor u, double
// uiAttributeUnderlineColor() returns the underline color stored in
// a. It is an error to call this on a uiAttribute that does not hold an
// underline color.
_UI_EXTERN void uiAttributeUnderline(const uiAttribute *a, uiUnderlineColor *u, double *r, double *g, double *b, double *alpha);
_UI_EXTERN void uiAttributeUnderlineColor(const uiAttribute *a, uiUnderlineColor *u, double *r, double *g, double *b, double *alpha);
// uiOpenTypeFeatures represents a set of OpenType feature
// tag-value pairs, for applying OpenType features to text.
@ -409,7 +409,7 @@ _UI_EXTERN size_t uiAttributedStringGraphemeToByteIndex(uiAttributedString *s, s
// All the members operate like the respective uiAttributes.
typedef struct uiFontDescriptor uiFontDescriptor;
struct uiDrawFontDescriptor {
struct uiFontDescriptor {
// TODO const-correct this or figure out how to deal with this when getting a value
char *Family;
double Size;
@ -448,7 +448,7 @@ typedef struct uiDrawTextLayoutParams uiDrawTextLayoutParams;
// TODO const-correct this somehow
struct uiDrawTextLayoutParams {
uiAttributedString *String;
uiDrawFontDescriptor *DefaultFont;
uiFontDescriptor *DefaultFont;
double Width;
uiDrawTextAlign Align;
};