FLTK logo

Re: [fltk/fltk] FLTK doesn't use system UI font (Issue #466)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.issues  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: [fltk/fltk] FLTK doesn't use system UI font (Issue #466) ManoloFLTK Jul 28, 2022  
 

I believe no new API is necessary, as shown by this code snippet :

#include <ApplicationServices/ApplicationServices.h>
  
  CTFontRef ft = CTFontCreateUIFontForLanguage(kCTFontUIFontSystem, 0, NULL);
  CFStringRef str = CTFontCopyFullName(ft);
  char fname[60];
  CFStringGetCString(str, fname, sizeof(fname), kCFStringEncodingUTF8);
  Fl_Fontsize size = CTFontGetSize(ft);
// printf("%s [%d]\n", fname, size);
  Fl::set_font(FL_FREE_FONT, fname);
// at this point, the system font is obtained by
  fl_font(FL_FREE_FONT, size);

This requires macOS 10.5 or above.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <fltk/fltk/issues/466/1197765090@github.com>

Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.