From 9aea7fa62e6d1880f4e4a80b501ac25d2a47c3c8 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sun, 18 Mar 2018 11:24:09 -0400 Subject: [PATCH] Polished up the drawtext demo a bit (such as finally fixing that titlebar). Also more crash-related TODOs. --- darwin/fontmatch.m | 3 +++ examples/drawtext/main.c | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/darwin/fontmatch.m b/darwin/fontmatch.m index f459a165..5b56f258 100644 --- a/darwin/fontmatch.m +++ b/darwin/fontmatch.m @@ -2,6 +2,9 @@ #import "uipriv_darwin.h" #import "attrstr.h" +// TODOs: +// - switching from Skia to a non-fvar-based font crashes because the CTFontDescriptorRef we get has an empty variation dictionary for some reason... + // Core Text exposes font style info in two forms: // - Fonts with a QuickDraw GX font variation (fvar) table, a feature // adopted by OpenType, expose variations directly. diff --git a/examples/drawtext/main.c b/examples/drawtext/main.c index 615340e7..45549dff 100644 --- a/examples/drawtext/main.c +++ b/examples/drawtext/main.c @@ -88,7 +88,9 @@ static void makeAttributedString(void) attr = uiNewFeaturesAttribute(otf); appendWithAttribute("afford", attr, NULL); uiFreeOpenTypeFeatures(otf); - uiAttributedStringAppendUnattributed(attrstr, ")."); + uiAttributedStringAppendUnattributed(attrstr, ").\n"); + + uiAttributedStringAppendUnattributed(attrstr, "Use the controls opposite to the text to control properties of the text."); } static void handlerDraw(uiAreaHandler *a, uiArea *area, uiAreaDrawParams *p) @@ -172,7 +174,7 @@ int main(void) makeAttributedString(); - mainwin = uiNewWindow("libui Histogram Example", 640, 480, 1); + mainwin = uiNewWindow("libui Text-Drawing Example", 640, 480, 1); uiWindowSetMargined(mainwin, 1); uiWindowOnClosing(mainwin, onClosing, NULL);