diff --git a/darwin/drawtext.m b/darwin/drawtext.m index d9626374..5e4b197a 100644 --- a/darwin/drawtext.m +++ b/darwin/drawtext.m @@ -119,11 +119,6 @@ static void addFontSmallCapsAttr(CFMutableDictionaryRef attr) CFRelease(outerArray); } -static void addFontGravityAttr(CFMutableDictionaryRef dict, uiDrawTextGravity gravity) -{ - // TODO: matrix setting? kCTFontOrientationAttribute? or is it a kCTVerticalFormsAttributeName of the CFAttributedString attributes and thus not part of the CTFontDescriptor? -} - // Named constants for these were NOT added until 10.11, and even then they were added as external symbols instead of macros, so we can't use them directly :( // kode54 got these for me before I had access to El Capitan; thanks to him. #define ourNSFontWeightUltraLight -0.800000 @@ -387,7 +382,6 @@ uiDrawTextFont *uiDrawLoadClosestFont(const uiDrawTextFontDescriptor *desc) // and finally add the other attributes if (desc->SmallCaps) addFontSmallCapsAttr(attr); - addFontGravityAttr(attr, desc->Gravity); // and NOW create the final descriptor cfdesc = CTFontDescriptorCreateWithAttributes(attr); diff --git a/test/page10.c b/test/page10.c index b0ea27f5..7bdda60e 100644 --- a/test/page10.c +++ b/test/page10.c @@ -96,7 +96,6 @@ static void handlerDraw(uiAreaHandler *a, uiArea *area, uiAreaDrawParams *dp) desc.Italic = uiComboboxSelected(textItalic); desc.SmallCaps = uiCheckboxChecked(textSmallCaps); desc.Stretch = uiComboboxSelected(textStretch); - desc.Gravity = uiComboboxSelected(textGravity); font = uiDrawLoadClosestFont(&desc); uiFreeText(family); uiDrawTextFontGetMetrics(font, &metrics); diff --git a/test/page9.c b/test/page9.c index c0d035f5..a6c452be 100644 --- a/test/page9.c +++ b/test/page9.c @@ -10,7 +10,6 @@ static uiCombobox *textWeight; static uiCombobox *textItalic; static uiCheckbox *textSmallCaps; static uiCombobox *textStretch; -static uiCombobox *textGravity; static uiEntry *textWidth; static uiButton *textApply; static uiCheckbox *addLeading; @@ -101,7 +100,6 @@ static void handlerDraw(uiAreaHandler *a, uiArea *area, uiAreaDrawParams *dp) desc.Italic = uiComboboxSelected(textItalic); desc.SmallCaps = uiCheckboxChecked(textSmallCaps); desc.Stretch = uiComboboxSelected(textStretch); - desc.Gravity = uiComboboxSelected(textGravity); font = uiDrawLoadClosestFont(&desc); uiFreeText(family); uiDrawTextFontGetMetrics(font, &metrics); @@ -230,15 +228,6 @@ uiBox *makePage9(void) uiComboboxSetSelected(textStretch, uiDrawTextStretchNormal); uiBoxAppend(hbox, uiControl(textStretch), 1); - textGravity = uiNewCombobox(); - uiComboboxAppend(textGravity, "South"); - uiComboboxAppend(textGravity, "East"); - uiComboboxAppend(textGravity, "North"); - uiComboboxAppend(textGravity, "West"); - uiComboboxAppend(textGravity, "Auto"); - uiComboboxSetSelected(textGravity, uiDrawTextGravitySouth); - uiBoxAppend(hbox, uiControl(textGravity), 1); - textWidth = uiNewEntry(); uiEntrySetText(textWidth, "-1"); uiBoxAppend(hbox, uiControl(textWidth), 1); diff --git a/ui.h b/ui.h index bcd2375f..676e732a 100644 --- a/ui.h +++ b/ui.h @@ -491,14 +491,6 @@ typedef enum uiDrawTextStretch { uiDrawTextStretchUltraExpanded, } uiDrawTextStretch; -typedef enum uiDrawTextGravity { - uiDrawTextGravitySouth, - uiDrawTextGravityEast, - uiDrawTextGravityNorth, - uiDrawTextGravityWest, - uiDrawTextGravityAuto, -} uiDrawTextGravity; - struct uiDrawTextFontDescriptor { const char *Family; double Size; @@ -506,7 +498,6 @@ struct uiDrawTextFontDescriptor { uiDrawTextItalic Italic; int SmallCaps; uiDrawTextStretch Stretch; - uiDrawTextGravity Gravity; }; struct uiDrawTextFontMetrics { diff --git a/unix/draw.c b/unix/draw.c index c58c6eb7..6f1c7df8 100644 --- a/unix/draw.c +++ b/unix/draw.c @@ -519,14 +519,6 @@ static const PangoStretch pangoStretches[] = { [uiDrawTextStretchUltraExpanded] = PANGO_STRETCH_ULTRA_EXPANDED, }; -static const PangoGravity pangoGravities[] = { - [uiDrawTextGravitySouth] = PANGO_GRAVITY_SOUTH, - [uiDrawTextGravityEast] = PANGO_GRAVITY_EAST, - [uiDrawTextGravityNorth] = PANGO_GRAVITY_NORTH, - [uiDrawTextGravityWest] = PANGO_GRAVITY_WEST, - [uiDrawTextGravityAuto] = PANGO_GRAVITY_AUTO, -}; - // we need a context for a few things // the documentation suggests creating cairo_t-specific, GdkScreen-specific, or even GtkWidget-specific contexts, but we can't really do that because we want our uiDrawTextFonts and uiDrawTextLayouts to be context-independent // so this will have to do @@ -557,8 +549,6 @@ uiDrawTextFont *uiDrawLoadClosestFont(const uiDrawTextFontDescriptor *desc) pango_font_description_set_variant(pdesc, variant); pango_font_description_set_stretch(pdesc, pangoStretches[desc->Stretch]); - pango_font_description_set_gravity(pdesc, - pangoGravities[desc->Gravity]); // in this case, the context is necessary for the metrics to be correct context = mkGenericPangoCairoContext(); diff --git a/windows/drawtext.cpp b/windows/drawtext.cpp index 488be226..493e0fad 100644 --- a/windows/drawtext.cpp +++ b/windows/drawtext.cpp @@ -172,7 +172,7 @@ uiDrawTextFont *uiDrawLoadClosestFont(const uiDrawTextFontDescriptor *desc) if (!found) complain("invalid initial stretch %d passed to uiDrawLoadClosestFont()", desc->Stretch); - // TODO small caps and gravity + // TODO small caps hr = family->GetFirstMatchingFont(weight, stretch, @@ -322,7 +322,6 @@ uiDrawTextLayout *uiDrawNewTextLayout(const char *text, uiDrawTextFont *defaultF if (hr != S_OK) logHRESULT("error creating IDWriteTextFormat in uiDrawNewTextLayout()", hr); // TODO small caps - // TODO gravity layout->bytesToCharacters = toUTF16Offsets(text, &wtext, &wlen); hr = dwfactory->CreateTextLayout(wtext, wlen,