Changed uiAttributeVerticalForms into a boolean. This is how the other features might need to be implemented :/
This commit is contained in:
parent
9a19c65323
commit
35a06e8540
|
@ -284,6 +284,13 @@ static struct attr *attrDeleteRange(struct attrlist *alist, struct attr *a, size
|
|||
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)
|
||||
{
|
||||
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.A == spec->A;
|
||||
case uiAttributeVerticalForms:
|
||||
return 1;
|
||||
return boolsEqual(attr, spec);
|
||||
// TODO
|
||||
}
|
||||
// handles the rest
|
||||
|
|
|
@ -132,7 +132,10 @@ static int processAttribute(uiAttributedString *s, uiAttributeSpec *spec, size_t
|
|||
Block_release(block);
|
||||
break;
|
||||
case uiAttributeVerticalForms:
|
||||
CFAttributedStringSetAttribute(p->mas, range, kCTVerticalFormsAttributeName, kCFBooleanTrue);
|
||||
if (spec->Value != 0)
|
||||
CFAttributedStringSetAttribute(p->mas, range, kCTVerticalFormsAttributeName, kCFBooleanTrue);
|
||||
else
|
||||
CFAttributedStringSetAttribute(p->mas, range, kCTVerticalFormsAttributeName, kCFBooleanFalse);
|
||||
break;
|
||||
// TODO
|
||||
}
|
||||
|
|
|
@ -96,6 +96,7 @@ static void setupAttributedString(void)
|
|||
end = start + strlen(next);
|
||||
uiAttributedStringAppendUnattributed(attrstr, next);
|
||||
spec.Type = uiAttributeVerticalForms;
|
||||
spec.Value = 1;
|
||||
uiAttributedStringSetAttribute(attrstr, &spec, start, end);
|
||||
|
||||
uiAttributedStringAppendUnattributed(attrstr, " (which you can draw rotated for proper vertical text)");
|
||||
|
|
|
@ -9,7 +9,7 @@ _UI_ENUM(uiAttribute) {
|
|||
uiAttributeStretch,
|
||||
uiAttributeColor, // use R, G, B, A
|
||||
uiAttributeBackground, // use R, G, B, A
|
||||
uiAttributeVerticalForms, // no parameter
|
||||
uiAttributeVerticalForms, // 0 = off, nonzero = 1
|
||||
// TODO
|
||||
// TODO uiAttributeSystem,
|
||||
// TODO uiAttributeCustom,
|
||||
|
|
Loading…
Reference in New Issue