diff --git a/uppsrc/CtrlCore/CocoDrawText.mm b/uppsrc/CtrlCore/CocoDrawText.mm index 6c0105915..5ef3a7871 100644 --- a/uppsrc/CtrlCore/CocoDrawText.mm +++ b/uppsrc/CtrlCore/CocoDrawText.mm @@ -137,40 +137,44 @@ GlyphInfo GetGlyphInfoSys(Font font, int chr) Vector GetAllFacesSys() { Index facename; - Index fixedpitch; facename.Add("Arial"); // TODO: This should be default GUI font facename.Add("Times New Roman"); facename.Add("Arial"); facename.Add("Courier New"); + int oi = facename.GetCount(); + AutoreleasePool __; - CFRef collection = CTFontCollectionCreateFromAvailableFonts(0); - if(collection) { - CFRef fonts = CTFontCollectionCreateMatchingFontDescriptors(collection); - if(fonts) { + CFRef collection = CTFontCollectionCreateFromAvailableFonts(0); + if(collection) { + CFRef fonts = CTFontCollectionCreateMatchingFontDescriptors(collection); + if(fonts) { int count = CFArrayGetCount(fonts); - for(int i = 0; i < count; ++i) { + for(int i = 0; i < count; ++i) { CTFontDescriptorRef font = (CTFontDescriptorRef)CFArrayGetValueAtIndex(fonts, i); CFRef family_name = (CFStringRef)CTFontDescriptorCopyAttribute(font, kCTFontFamilyNameAttribute); facename.FindAdd(ToString(family_name)); - } + } } - } - + } + + Vector h = facename.PickKeys(); + Sort(SubRange(h, oi, h.GetCount() - oi)); + Vector r; - for(String s : facename) { - FaceInfo& fi = r.Add(); + for(String s : h) { + FaceInfo& fi = r.Add(); fi.name = s; fi.info = Font::TTF; CFRef fs = CFStringCreateWithCString(NULL, ~s, kCFStringEncodingUTF8); - CFRef ctfont = CTFontCreateWithName(fs, 12, NULL); - if(CTFontGetSymbolicTraits(ctfont) & kCTFontMonoSpaceTrait) - fi.info |= Font::FIXEDPITCH; - } - - return r; + CFRef ctfont = CTFontCreateWithName(fs, 12, NULL); + if(CTFontGetSymbolicTraits(ctfont) & kCTFontMonoSpaceTrait) + fi.info |= Font::FIXEDPITCH; + } + + return r; } String GetFontDataSys(Font font) diff --git a/uppsrc/CtrlCore/cocotodo.txt b/uppsrc/CtrlCore/cocotodo.txt index 49f42c47c..9175d944f 100644 --- a/uppsrc/CtrlCore/cocotodo.txt +++ b/uppsrc/CtrlCore/cocotodo.txt @@ -2,9 +2,7 @@ sooner: - default GUI font - minimize, maximaze -- numpad Enter does not do K_ENTER - Sort fonts - - not all additional cursors are correct - fix package organiser link options (joining link options missing space) @@ -12,6 +10,7 @@ sooner: later: +- apple debugger - package organizer initial size too small - void WakeUpGuiThread(void) - fullscreen mode issues @@ -39,6 +38,7 @@ void SystemDraw::DrawArcOp(const Rect& rc, Point start, Point end, int width, Co done: +- numpad Enter does not do K_ENTER - Synthetise fonts - RenderCharacterSys - ROTATED TEXT