~ubuntu-branches/ubuntu/trusty/lmms/trusty

« back to all changes in this revision

Viewing changes to plugins/zynaddsubfx/fltk/src/fl_set_fonts_mac.cxx

  • Committer: Charlie Smotherman
  • Date: 2012-12-05 22:08:38 UTC
  • mfrom: (33.1.7 lmms_0.4.13)
  • Revision ID: cjsmo@cableone.net-20121205220838-09pjfzew9m5023hr
* New  Upstream release.
  - Minor tweaking to ZynAddSubFX, CALF, SWH plugins  and Stefan Fendt's RC
    filters.
  - Added UI fixes: Magnentic effect of knobs and Piano-roll fixes
  - Updated German localization and copyright year
* debian/lmms-common.install:
  - added /usr/share/applications so the lmms.desktop file will correctly
    install (LP: #863366)
  - This should also fix the Software Center not displaying lmms in sound
    and video (LP: #824231)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//
2
 
// "$Id: fl_set_fonts_mac.cxx 7351 2010-03-29 10:35:00Z matt $"
 
2
// "$Id: fl_set_fonts_mac.cxx 8504 2011-03-04 16:48:10Z manolo $"
3
3
//
4
4
// MacOS font utilities for the Fast Light Tool Kit (FLTK).
5
5
//
6
 
// Copyright 1998-2009 by Bill Spitzak and others.
 
6
// Copyright 1998-2011 by Bill Spitzak and others.
7
7
//
8
8
// This library is free software; you can redistribute it and/or
9
9
// modify it under the terms of the GNU Library General Public
56
56
  return f->fontname;
57
57
}
58
58
 
 
59
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
 
60
static int name_compare(const void *a, const void *b)
 
61
{
 
62
  return strcmp(*(char**)a, *(char**)b);
 
63
}
 
64
#endif
 
65
 
59
66
static int fl_free_font = FL_FREE_FONT;
60
67
 
61
68
Fl_Font Fl::set_fonts(const char* xstarname) {
62
69
#pragma unused ( xstarname )
 
70
if (fl_free_font > FL_FREE_FONT) return (Fl_Font)fl_free_font; // if already called
 
71
 
63
72
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
64
 
static SInt32 MACsystemVersion = 0;
65
 
if(MACsystemVersion == 0) Gestalt(gestaltSystemVersion, &MACsystemVersion);
66
 
if(MACsystemVersion >= 0x1050) {
 
73
if(fl_mac_os_version >= 100500) {
67
74
//if(CTFontCreateWithFontDescriptor != NULL) {// CTFontCreateWithFontDescriptor != NULL on 10.4 also!
68
75
  int value[1] = {1};
69
76
  CFDictionaryRef dict = CFDictionaryCreate(NULL, 
75
82
  CFRelease(fcref);
76
83
  CFIndex count = CFArrayGetCount(arrayref);
77
84
  CFIndex i;
 
85
  char **tabfontnames = new char*[count];
78
86
  for (i = 0; i < count; i++) {
79
87
        CTFontDescriptorRef fdesc = (CTFontDescriptorRef)CFArrayGetValueAtIndex(arrayref, i);
80
88
        CTFontRef font = CTFontCreateWithFontDescriptor(fdesc, 0., NULL);
81
 
        CFStringRef cfname = CTFontCopyPostScriptName(font);
 
89
        CFStringRef cfname = CTFontCopyFullName(font);
82
90
        CFRelease(font);
83
91
        static char fname[100];
84
92
        CFStringGetCString(cfname, fname, sizeof(fname), kCFStringEncodingUTF8);
 
93
        tabfontnames[i] = strdup(fname); // never free'ed
85
94
        CFRelease(cfname);
86
 
        Fl::set_font((Fl_Font)(fl_free_font++), strdup(fname));
87
95
        }
88
96
  CFRelease(arrayref);
 
97
  qsort(tabfontnames, count, sizeof(char*), name_compare);
 
98
  for (i = 0; i < count; i++) {
 
99
    Fl::set_font((Fl_Font)(fl_free_font++), tabfontnames[i]);
 
100
    }
 
101
  delete[] tabfontnames;
89
102
  return (Fl_Font)fl_free_font;
90
103
}
91
104
else {
129
142
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
130
143
  }
131
144
#endif
132
 
  return 0; // FIXME: I do not understand the shuffeling of the above ifdef's and why they are here!
 
145
  return 0;
133
146
}
134
147
 
135
148
static int array[128];
147
160
}
148
161
 
149
162
//
150
 
// End of "$Id: fl_set_fonts_mac.cxx 7351 2010-03-29 10:35:00Z matt $".
 
163
// End of "$Id: fl_set_fonts_mac.cxx 8504 2011-03-04 16:48:10Z manolo $".
151
164
//