diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-07-01 18:03:10 +0200 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-07-06 20:28:20 +0200 |
| commit | f09e17c3c564e8310125a10c03397cbf473ff643 (patch) | |
| tree | 8d0fd4a28e3686c33aaa140d07ddba26ab28bdc2 /src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx | |
| parent | b0e0c355edaa2e23148cb0260ada907aec930f05 (diff) | |
Remove $Id$ tags, update URL's, and more
- remove obsolete svn '$Id$' tags from all source files
- update .fl files and generated files accordingly
- replace 'http://www.fltk.org' URL's with 'https://...'
- replace bug report URL 'str.php' with 'bugs.php'
- remove trailing whitespace
- fix other whitespace errors flagged by Git
- add and/or fix missing or wrong standard headers
- convert tabs to spaces in all source files
The only relevant code changes are in the fluid/ folder where
some .fl files and other source files were used to generate
the '$Id' headers and footers.
Diffstat (limited to 'src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx')
| -rw-r--r-- | src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx | 52 |
1 files changed, 23 insertions, 29 deletions
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx index 6dcfd7ca2..c528f2721 100644 --- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx +++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx @@ -1,6 +1,4 @@ // -// "$Id$" -// // MacOS font selection routines for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2018 by Bill Spitzak and others. @@ -9,11 +7,11 @@ // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // -// http://www.fltk.org/COPYING.php +// https://www.fltk.org/COPYING.php // -// Please report all bugs and problems on the following page: +// Please see the following page on how to report bugs and issues: // -// http://www.fltk.org/str.php +// https://www.fltk.org/bugs.php // /* Implementation of support for two text drawing APIs: Core Text (current) and ATSU (legacy) @@ -234,9 +232,9 @@ static UniChar *mac_Utf8_to_Utf16(const char *txt, int len, int *new_len) if (wlen >= utfWlen) { utfWlen = wlen + 100; - if (utfWbuf) free(utfWbuf); + if (utfWbuf) free(utfWbuf); utfWbuf = (UniChar*)malloc((utfWlen)*sizeof(UniChar)); - wlen = fl_utf8toUtf16(txt, len, (unsigned short*)utfWbuf, utfWlen); + wlen = fl_utf8toUtf16(txt, len, (unsigned short*)utfWbuf, utfWlen); } *new_len = wlen; return utfWbuf; @@ -522,15 +520,15 @@ double Fl_Quartz_Graphics_Driver::ADD_SUFFIX(width, _CoreText)(const UniChar* tx CGSize advance_size; CGGlyph glyph; for (int j = 0; j < block; j++) { // loop over the block - // ii spans all characters of this block - bool b = CTFontGetGlyphsForCharacters(fl_fontsize->fontref, &ii, &glyph, 1); - if (b) - CTFontGetAdvancesForGlyphs(fl_fontsize->fontref, kCTFontHorizontalOrientation, &glyph, &advance_size, 1); - else - advance_size.width = -1e9; // calculate this later - // the width of one character of this block of characters - fl_fontsize->width[r][j] = advance_size.width; - ii++; + // ii spans all characters of this block + bool b = CTFontGetGlyphsForCharacters(fl_fontsize->fontref, &ii, &glyph, 1); + if (b) + CTFontGetAdvancesForGlyphs(fl_fontsize->fontref, kCTFontHorizontalOrientation, &glyph, &advance_size, 1); + else + advance_size.width = -1e9; // calculate this later + // the width of one character of this block of characters + fl_fontsize->width[r][j] = advance_size.width; + ii++; } } // sum the widths of all characters of txt @@ -542,12 +540,12 @@ double Fl_Quartz_Graphics_Driver::ADD_SUFFIX(width, _CoreText)(const UniChar* tx bool must_release = false; bool b = CTFontGetGlyphsForCharacters(font2, &uni, &glyph, 1); if (!b) { // the current font doesn't contain this char - CFStringRef str = CFStringCreateWithCharactersNoCopy(NULL, &uni, 1, kCFAllocatorNull); - // find a font that contains it - font2 = CTFontCreateForString(font2, str, CFRangeMake(0,1)); - must_release = true; - CFRelease(str); - b = CTFontGetGlyphsForCharacters(font2, &uni, &glyph, 1); + CFStringRef str = CFStringCreateWithCharactersNoCopy(NULL, &uni, 1, kCFAllocatorNull); + // find a font that contains it + font2 = CTFontCreateForString(font2, str, CFRangeMake(0,1)); + must_release = true; + CFRelease(str); + b = CTFontGetGlyphsForCharacters(font2, &uni, &glyph, 1); } if (b) CTFontGetAdvancesForGlyphs(font2, kCTFontHorizontalOrientation, &glyph, &advance_size, 1); else advance_size.width = 0.; @@ -847,13 +845,13 @@ Fl_Font Fl_Quartz_Graphics_Driver::ADD_SUFFIX(set_fonts, _ATSU)(const char* xsta for (ItemCount idx = 0; idx < oFontCount; idx++) { // ByteCount actualLength = 0; - // Ptr oName; + // Ptr oName; // How to get the name - Apples docs say call this twice, once to get the length, then again // to get the actual name... // ATSUFindFontName (oFontIDs[idx], kFontFullName, kFontMacintoshPlatform, kFontRomanScript, kFontEnglishLanguage, // 0, NULL, &actualLength, NULL); // Now actualLength tells us the length of buffer we need - // oName = (Ptr)malloc(actualLength + 8); + // oName = (Ptr)malloc(actualLength + 8); // But who's got time for that nonsense? Let's just hard code a fixed buffer (urgh!) ByteCount actualLength = 511; char oName[512]; @@ -865,7 +863,7 @@ Fl_Font Fl_Quartz_Graphics_Driver::ADD_SUFFIX(set_fonts, _ATSU)(const char* xsta else oName[actualLength] = 0; Fl::set_font((Fl_Font)(fl_free_font++), strdup(oName)); - // free(oName); + // free(oName); } free(oFontIDs); return (Fl_Font)fl_free_font; @@ -874,7 +872,3 @@ Fl_Font Fl_Quartz_Graphics_Driver::ADD_SUFFIX(set_fonts, _ATSU)(const char* xsta #endif // HAS_ATSU #endif // FL_CFG_GFX_QUARTZ - -// -// End of "$Id$". -// |
