Changed uiAttributeVerticalForms into a boolean. This is how the other features might need to be implemented :/

This commit is contained in:
Pietro Gagliardi 2017-02-13 22:42:18 -05:00
parent 9a19c65323
commit 35a06e8540
4 changed files with 14 additions and 3 deletions

View File

@ -284,6 +284,13 @@ static struct attr *attrDeleteRange(struct attrlist *alist, struct attr *a, size
return a->next; return a->next;
} }
static int boolsEqual(struct attr *attr, uiAttributeSpec *spec)
{
if (attr->spec.Value == 0 && spec->Value == 0)
return 1;
return attr->spec.Value != 0 && spec->Value != 0;
}
static int specsIdentical(struct attr *attr, uiAttributeSpec *spec) static int specsIdentical(struct attr *attr, uiAttributeSpec *spec)
{ {
if (attr->spec.Type != spec->Type) if (attr->spec.Type != spec->Type)
@ -303,7 +310,7 @@ static int specsIdentical(struct attr *attr, uiAttributeSpec *spec)
attr->spec.B == spec->B && attr->spec.B == spec->B &&
attr->spec.A == spec->A; attr->spec.A == spec->A;
case uiAttributeVerticalForms: case uiAttributeVerticalForms:
return 1; return boolsEqual(attr, spec);
// TODO // TODO
} }
// handles the rest // handles the rest

View File

@ -132,7 +132,10 @@ static int processAttribute(uiAttributedString *s, uiAttributeSpec *spec, size_t
Block_release(block); Block_release(block);
break; break;
case uiAttributeVerticalForms: case uiAttributeVerticalForms:
if (spec->Value != 0)
CFAttributedStringSetAttribute(p->mas, range, kCTVerticalFormsAttributeName, kCFBooleanTrue); CFAttributedStringSetAttribute(p->mas, range, kCTVerticalFormsAttributeName, kCFBooleanTrue);
else
CFAttributedStringSetAttribute(p->mas, range, kCTVerticalFormsAttributeName, kCFBooleanFalse);
break; break;
// TODO // TODO
} }

View File

@ -96,6 +96,7 @@ static void setupAttributedString(void)
end = start + strlen(next); end = start + strlen(next);
uiAttributedStringAppendUnattributed(attrstr, next); uiAttributedStringAppendUnattributed(attrstr, next);
spec.Type = uiAttributeVerticalForms; spec.Type = uiAttributeVerticalForms;
spec.Value = 1;
uiAttributedStringSetAttribute(attrstr, &spec, start, end); uiAttributedStringSetAttribute(attrstr, &spec, start, end);
uiAttributedStringAppendUnattributed(attrstr, " (which you can draw rotated for proper vertical text)"); uiAttributedStringAppendUnattributed(attrstr, " (which you can draw rotated for proper vertical text)");

View File

@ -9,7 +9,7 @@ _UI_ENUM(uiAttribute) {
uiAttributeStretch, uiAttributeStretch,
uiAttributeColor, // use R, G, B, A uiAttributeColor, // use R, G, B, A
uiAttributeBackground, // use R, G, B, A uiAttributeBackground, // use R, G, B, A
uiAttributeVerticalForms, // no parameter uiAttributeVerticalForms, // 0 = off, nonzero = 1
// TODO // TODO
// TODO uiAttributeSystem, // TODO uiAttributeSystem,
// TODO uiAttributeCustom, // TODO uiAttributeCustom,