diff --git a/common/attrlist.c b/common/attrlist.c index e4c8ad67..1ca52537 100644 --- a/common/attrlist.c +++ b/common/attrlist.c @@ -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 diff --git a/darwin/attrstr.m b/darwin/attrstr.m index 07663838..051bec16 100644 --- a/darwin/attrstr.m +++ b/darwin/attrstr.m @@ -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 } diff --git a/examples/drawtext/attributes.c b/examples/drawtext/attributes.c index 7599dcfc..1aa74a72 100644 --- a/examples/drawtext/attributes.c +++ b/examples/drawtext/attributes.c @@ -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)"); diff --git a/ui_attrstr.h b/ui_attrstr.h index 6d6021d2..f5506fa0 100644 --- a/ui_attrstr.h +++ b/ui_attrstr.h @@ -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,