OpenTTD Source 20250813-master-g5b5bdd346d
font_osx.cpp
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7
10#include "../../stdafx.h"
11#include "../../debug.h"
12#include "font_osx.h"
13#include "../../core/math_func.hpp"
14#include "../../blitter/factory.hpp"
15#include "../../error_func.h"
16#include "../../fileio_func.h"
17#include "../../string_func.h"
18#include "../../strings_func.h"
19#include "../../zoom_func.h"
20#include "macos.h"
21
22#include "../../table/control_codes.h"
23
24#include "../../safeguards.h"
25
26CoreTextFontCache::CoreTextFontCache(FontSize fs, CFAutoRelease<CTFontDescriptorRef> &&font, int pixels) : TrueTypeFontCache(fs, pixels), font_desc(std::move(font))
27{
28 this->SetFontSize(pixels);
29}
30
35{
36 /* GUI scaling might have changed, determine font size anew if it was automatically selected. */
37 if (this->font) this->SetFontSize(this->req_size);
38
40}
41
42void CoreTextFontCache::SetFontSize(int pixels)
43{
44 if (pixels == 0) {
45 /* Try to determine a good height based on the height recommended by the font. */
46 int scaled_height = ScaleGUITrad(FontCache::GetDefaultFontHeight(this->fs));
47 pixels = scaled_height;
48
49 CFAutoRelease<CTFontRef> font(CTFontCreateWithFontDescriptor(this->font_desc.get(), 0.0f, nullptr));
50 if (font) {
51 float min_size = 0.0f;
52
53 /* The 'head' TrueType table contains information about the
54 * 'smallest readable size in pixels'. Try to read it, if
55 * that doesn't work, we use the default OS font size instead.
56 *
57 * Reference: https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6head.html */
58 CFAutoRelease<CFDataRef> data(CTFontCopyTable(font.get(), kCTFontTableHead, kCTFontTableOptionNoOptions));
59 if (data) {
60 uint16_t lowestRecPPEM; // At offset 46 of the 'head' TrueType table.
61 CFDataGetBytes(data.get(), CFRangeMake(46, sizeof(lowestRecPPEM)), (UInt8 *)&lowestRecPPEM);
62 min_size = CFSwapInt16BigToHost(lowestRecPPEM); // TrueType data is always big-endian.
63 } else {
64 CFAutoRelease<CFNumberRef> size((CFNumberRef)CTFontCopyAttribute(font.get(), kCTFontSizeAttribute));
65 CFNumberGetValue(size.get(), kCFNumberFloatType, &min_size);
66 }
67
68 /* Font height is minimum height plus the difference between the default
69 * height for this font size and the small size. */
70 int diff = scaled_height - ScaleGUITrad(FontCache::GetDefaultFontHeight(FS_SMALL));
71 /* Clamp() is not used as scaled_height could be greater than MAX_FONT_SIZE, which is not permitted in Clamp(). */
72 pixels = std::min(std::max(std::min<int>(min_size, MAX_FONT_MIN_REC_SIZE) + diff, scaled_height), MAX_FONT_SIZE);
73 }
74 } else {
75 pixels = ScaleGUITrad(pixels);
76 }
77 this->used_size = pixels;
78
79 this->font.reset(CTFontCreateWithFontDescriptor(this->font_desc.get(), pixels, nullptr));
80
81 /* Query the font metrics we needed. We generally round all values up to
82 * make sure we don't inadvertently cut off a row or column of pixels,
83 * except when determining glyph to glyph advances. */
84 this->ascender = (int)std::ceil(CTFontGetAscent(this->font.get()));
85 this->descender = -(int)std::ceil(CTFontGetDescent(this->font.get()));
86 this->height = this->ascender - this->descender;
87
88 /* Get real font name. */
89 char name[128];
90 CFAutoRelease<CFStringRef> font_name((CFStringRef)CTFontCopyAttribute(this->font.get(), kCTFontDisplayNameAttribute));
91 CFStringGetCString(font_name.get(), name, lengthof(name), kCFStringEncodingUTF8);
92 this->font_name = name;
93
94 Debug(fontcache, 2, "Loaded font '{}' with size {}", this->font_name, pixels);
95}
96
97GlyphID CoreTextFontCache::MapCharToGlyph(char32_t key, bool allow_fallback)
98{
99 assert(IsPrintable(key));
100
101 /* Convert characters outside of the Basic Multilingual Plane into surrogate pairs. */
102 UniChar chars[2];
103 if (key >= 0x010000U) {
104 chars[0] = (UniChar)(((key - 0x010000U) >> 10) + 0xD800);
105 chars[1] = (UniChar)(((key - 0x010000U) & 0x3FF) + 0xDC00);
106 } else {
107 chars[0] = (UniChar)(key & 0xFFFF);
108 }
109
110 CGGlyph glyph[2] = {0, 0};
111 if (CTFontGetGlyphsForCharacters(this->font.get(), chars, glyph, key >= 0x010000U ? 2 : 1)) {
112 return glyph[0];
113 }
114
115 if (allow_fallback && key >= SCC_SPRITE_START && key <= SCC_SPRITE_END) {
116 return this->parent->MapCharToGlyph(key);
117 }
118
119 return 0;
120}
121
122const Sprite *CoreTextFontCache::InternalGetGlyph(GlyphID key, bool use_aa)
123{
124 /* Get glyph size. */
125 CGGlyph glyph = (CGGlyph)key;
126 CGRect bounds = CGRectNull;
127 if (MacOSVersionIsAtLeast(10, 8, 0)) {
128 bounds = CTFontGetOpticalBoundsForGlyphs(this->font.get(), &glyph, nullptr, 1, 0);
129 } else {
130 bounds = CTFontGetBoundingRectsForGlyphs(this->font.get(), kCTFontOrientationDefault, &glyph, nullptr, 1);
131 }
132 if (CGRectIsNull(bounds)) UserError("Unable to render font glyph");
133
134 uint bb_width = (uint)std::ceil(bounds.size.width) + 1; // Sometimes the glyph bounds are too tight and cut of the last pixel after rounding.
135 uint bb_height = (uint)std::ceil(bounds.size.height);
136
137 /* Add 1 scaled pixel for the shadow on the medium font. Our sprite must be at least 1x1 pixel. */
138 uint shadow = (this->fs == FS_NORMAL) ? ScaleGUITrad(1) : 0;
139 uint width = std::max(1U, bb_width + shadow);
140 uint height = std::max(1U, bb_height + shadow);
141
142 /* Limit glyph size to prevent overflows later on. */
143 if (width > MAX_GLYPH_DIM || height > MAX_GLYPH_DIM) UserError("Font glyph is too large");
144
145 SpriteLoader::SpriteCollection spritecollection;
146 SpriteLoader::Sprite &sprite = spritecollection[ZoomLevel::Min];
147 sprite.AllocateData(ZoomLevel::Min, width * height);
149 if (use_aa) sprite.colours.Set(SpriteComponent::Alpha);
150 sprite.width = width;
151 sprite.height = height;
152 sprite.x_offs = (int16_t)std::round(CGRectGetMinX(bounds));
153 sprite.y_offs = this->ascender - (int16_t)std::ceil(CGRectGetMaxY(bounds));
154
155 if (bounds.size.width > 0) {
156 /* Glyph is not a white-space glyph. Render it to a bitmap context. */
157
158 /* We only need the alpha channel, as we apply our own colour constants to the sprite. */
159 int pitch = Align(bb_width, 16);
160 CFAutoRelease<CGContextRef> context(CGBitmapContextCreate(nullptr, bb_width, bb_height, 8, pitch, nullptr, kCGImageAlphaOnly));
161 const uint8_t *bmp = static_cast<uint8_t *>(CGBitmapContextGetData(context.get()));
162 /* Set antialias according to requirements. */
163 CGContextSetAllowsAntialiasing(context.get(), use_aa);
164 CGContextSetAllowsFontSubpixelPositioning(context.get(), use_aa);
165 CGContextSetAllowsFontSubpixelQuantization(context.get(), !use_aa);
166 CGContextSetShouldSmoothFonts(context.get(), false);
167
168 CGPoint pos{-bounds.origin.x, -bounds.origin.y};
169 CTFontDrawGlyphs(this->font.get(), &glyph, &pos, 1, context.get());
170
171 /* Draw shadow for medium size. */
172 if (this->fs == FS_NORMAL && !use_aa) {
173 for (uint y = 0; y < bb_height; y++) {
174 for (uint x = 0; x < bb_width; x++) {
175 if (bmp[y * pitch + x] > 0) {
176 sprite.data[shadow + x + (shadow + y) * sprite.width].m = SHADOW_COLOUR;
177 sprite.data[shadow + x + (shadow + y) * sprite.width].a = use_aa ? bmp[x + y * pitch] : 0xFF;
178 }
179 }
180 }
181 }
182
183 /* Extract pixel data. */
184 for (uint y = 0; y < bb_height; y++) {
185 for (uint x = 0; x < bb_width; x++) {
186 if (bmp[y * pitch + x] > 0) {
187 sprite.data[x + y * sprite.width].m = FACE_COLOUR;
188 sprite.data[x + y * sprite.width].a = use_aa ? bmp[x + y * pitch] : 0xFF;
189 }
190 }
191 }
192 }
193
194 UniquePtrSpriteAllocator allocator;
195 BlitterFactory::GetCurrentBlitter()->Encode(SpriteType::Font, spritecollection, allocator);
196
197 GlyphEntry new_glyph;
198 new_glyph.data = std::move(allocator.data);
199 new_glyph.width = (uint8_t)std::round(CTFontGetAdvancesForGlyphs(this->font.get(), kCTFontOrientationDefault, &glyph, nullptr, 1));
200
201 return this->SetGlyphPtr(key, std::move(new_glyph)).GetSprite();
202}
203
205public:
206 CoreTextFontCacheFactory() : FontCacheFactory("coretext", "CoreText font loader") {}
207
214 std::unique_ptr<FontCache> LoadFont(FontSize fs, FontType fonttype) override
215 {
216 if (fonttype != FontType::TrueType) return nullptr;
217
219
220 std::string font = GetFontCacheFontName(fs);
221 if (font.empty()) return nullptr;
222
224
225 if (settings->os_handle != nullptr) {
226 font_ref.reset(static_cast<CTFontDescriptorRef>(const_cast<void *>(settings->os_handle)));
227 CFRetain(font_ref.get()); // Increase ref count to match a later release.
228 }
229
230 if (!font_ref && MacOSVersionIsAtLeast(10, 6, 0)) {
231 /* Might be a font file name, try load it. */
232 font_ref.reset(LoadFontFromFile(font));
233 if (!font_ref) ShowInfo("Unable to load file '{}' for {} font, using default OS font selection instead", font, FontSizeToName(fs));
234 }
235
236 if (!font_ref) {
237 CFAutoRelease<CFStringRef> name(CFStringCreateWithCString(kCFAllocatorDefault, font.c_str(), kCFStringEncodingUTF8));
238
239 /* Simply creating the font using CTFontCreateWithNameAndSize will *always* return
240 * something, no matter the name. As such, we can't use it to check for existence.
241 * We instead query the list of all font descriptors that match the given name which
242 * does not do this stupid name fallback. */
243 CFAutoRelease<CTFontDescriptorRef> name_desc(CTFontDescriptorCreateWithNameAndSize(name.get(), 0.0));
244 CFAutoRelease<CFSetRef> mandatory_attribs(CFSetCreate(kCFAllocatorDefault, const_cast<const void **>(reinterpret_cast<const void * const *>(&kCTFontNameAttribute)), 1, &kCFTypeSetCallBacks));
245 CFAutoRelease<CFArrayRef> descs(CTFontDescriptorCreateMatchingFontDescriptors(name_desc.get(), mandatory_attribs.get()));
246
247 /* Assume the first result is the one we want. */
248 if (descs && CFArrayGetCount(descs.get()) > 0) {
249 font_ref.reset((CTFontDescriptorRef)CFArrayGetValueAtIndex(descs.get(), 0));
250 CFRetain(font_ref.get());
251 }
252 }
253
254 if (!font_ref) {
255 ShowInfo("Unable to use '{}' for {} font, using sprite font instead", font, FontSizeToName(fs));
256 return nullptr;
257 }
258
259 return std::make_unique<CoreTextFontCache>(fs, std::move(font_ref), GetFontCacheFontSize(fs));
260 }
261
262 bool FindFallbackFont(FontCacheSettings *settings, const std::string &language_isocode, MissingGlyphSearcher *callback) override
263 {
264 /* Determine fallback font using CoreText. This uses the language isocode
265 * to find a suitable font. CoreText is available from 10.5 onwards. */
266 std::string lang;
267 if (language_isocode == "zh_TW") {
268 /* Traditional Chinese */
269 lang = "zh-Hant";
270 } else if (language_isocode == "zh_CN") {
271 /* Simplified Chinese */
272 lang = "zh-Hans";
273 } else {
274 /* Just copy the first part of the isocode. */
275 lang = language_isocode.substr(0, language_isocode.find('_'));
276 }
277
278 /* Create a font descriptor matching the wanted language and latin (english) glyphs.
279 * Can't use CFAutoRelease here for everything due to the way the dictionary has to be created. */
280 CFStringRef lang_codes[2];
281 lang_codes[0] = CFStringCreateWithCString(kCFAllocatorDefault, lang.c_str(), kCFStringEncodingUTF8);
282 lang_codes[1] = CFSTR("en");
283 CFArrayRef lang_arr = CFArrayCreate(kCFAllocatorDefault, (const void **)lang_codes, lengthof(lang_codes), &kCFTypeArrayCallBacks);
284 CFAutoRelease<CFDictionaryRef> lang_attribs(CFDictionaryCreate(kCFAllocatorDefault, const_cast<const void **>(reinterpret_cast<const void *const *>(&kCTFontLanguagesAttribute)), (const void **)&lang_arr, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
285 CFAutoRelease<CTFontDescriptorRef> lang_desc(CTFontDescriptorCreateWithAttributes(lang_attribs.get()));
286 CFRelease(lang_arr);
287 CFRelease(lang_codes[0]);
288
289 /* Get array of all font descriptors for the wanted language. */
290 CFAutoRelease<CFSetRef> mandatory_attribs(CFSetCreate(kCFAllocatorDefault, const_cast<const void **>(reinterpret_cast<const void *const *>(&kCTFontLanguagesAttribute)), 1, &kCFTypeSetCallBacks));
291 CFAutoRelease<CFArrayRef> descs(CTFontDescriptorCreateMatchingFontDescriptors(lang_desc.get(), mandatory_attribs.get()));
292
293 bool result = false;
294 for (int tries = 0; tries < 2; tries++) {
295 for (CFIndex i = 0; descs.get() != nullptr && i < CFArrayGetCount(descs.get()); i++) {
296 CTFontDescriptorRef font = (CTFontDescriptorRef)CFArrayGetValueAtIndex(descs.get(), i);
297
298 /* Get font traits. */
299 CFAutoRelease<CFDictionaryRef> traits((CFDictionaryRef)CTFontDescriptorCopyAttribute(font, kCTFontTraitsAttribute));
300 CTFontSymbolicTraits symbolic_traits;
301 CFNumberGetValue((CFNumberRef)CFDictionaryGetValue(traits.get(), kCTFontSymbolicTrait), kCFNumberIntType, &symbolic_traits);
302
303 /* Skip symbol fonts and vertical fonts. */
304 if ((symbolic_traits & kCTFontClassMaskTrait) == (CTFontStylisticClass)kCTFontSymbolicClass || (symbolic_traits & kCTFontVerticalTrait)) continue;
305 /* Skip bold fonts (especially Arial Bold, which looks worse than regular Arial). */
306 if (symbolic_traits & kCTFontBoldTrait) continue;
307 /* Select monospaced fonts if asked for. */
308 if (((symbolic_traits & kCTFontMonoSpaceTrait) == kCTFontMonoSpaceTrait) != callback->Monospace()) continue;
309
310 /* Get font name. */
311 char buffer[128];
312 CFAutoRelease<CFStringRef> font_name((CFStringRef)CTFontDescriptorCopyAttribute(font, kCTFontDisplayNameAttribute));
313 CFStringGetCString(font_name.get(), buffer, std::size(buffer), kCFStringEncodingUTF8);
314
315 /* Serif fonts usually look worse on-screen with only small
316 * font sizes. As such, we try for a sans-serif font first.
317 * If we can't find one in the first try, try all fonts. */
318 if (tries == 0 && (symbolic_traits & kCTFontClassMaskTrait) != (CTFontStylisticClass)kCTFontSansSerifClass) continue;
319
320 /* There are some special fonts starting with an '.' and the last
321 * resort font that aren't usable. Skip them. */
322 std::string_view name{buffer};
323 if (name.starts_with(".") || name.starts_with("LastResort")) continue;
324
325 /* Save result. */
326 callback->SetFontNames(settings, name);
327 if (!callback->FindMissingGlyphs()) {
328 Debug(fontcache, 2, "CT-Font for {}: {}", language_isocode, name);
329 result = true;
330 break;
331 }
332 }
333 }
334
335 if (!result) {
336 /* For some OS versions, the font 'Arial Unicode MS' does not report all languages it
337 * supports. If we didn't find any other font, just try it, maybe we get lucky. */
338 callback->SetFontNames(settings, "Arial Unicode MS");
339 result = !callback->FindMissingGlyphs();
340 }
341
342 callback->FindMissingGlyphs();
343 return result;
344 }
345
346private:
347 static CTFontDescriptorRef LoadFontFromFile(const std::string &font_name)
348 {
349 if (!MacOSVersionIsAtLeast(10, 6, 0)) return nullptr;
350
351 /* Might be a font file name, try load it. Direct font loading is
352 * only supported starting on OSX 10.6. */
354
355 /* See if this is an absolute path. */
356 if (FileExists(font_name)) {
357 path.reset(CFStringCreateWithCString(kCFAllocatorDefault, font_name.c_str(), kCFStringEncodingUTF8));
358 } else {
359 /* Scan the search-paths to see if it can be found. */
360 std::string full_font = FioFindFullPath(BASE_DIR, font_name);
361 if (!full_font.empty()) {
362 path.reset(CFStringCreateWithCString(kCFAllocatorDefault, full_font.c_str(), kCFStringEncodingUTF8));
363 }
364 }
365
366 if (path) {
367 /* Try getting a font descriptor to see if the system can use it. */
368 CFAutoRelease<CFURLRef> url(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path.get(), kCFURLPOSIXPathStyle, false));
369 CFAutoRelease<CFArrayRef> descs(CTFontManagerCreateFontDescriptorsFromURL(url.get()));
370
371 if (descs && CFArrayGetCount(descs.get()) > 0) {
372 CTFontDescriptorRef font_ref = (CTFontDescriptorRef)CFArrayGetValueAtIndex(descs.get(), 0);
373 CFRetain(font_ref);
374 return font_ref;
375 }
376 }
377
378 return nullptr;
379 }
380
381private:
382 static CoreTextFontCacheFactory instance;
383};
384
385/* static */ CoreTextFontCacheFactory CoreTextFontCacheFactory::instance;
constexpr Timpl & Set()
Set all bits.
static Blitter * GetCurrentBlitter()
Get the current active blitter (always set by calling SelectBlitter).
Definition factory.hpp:136
std::unique_ptr< FontCache > LoadFont(FontSize fs, FontType fonttype) override
Loads the TrueType font.
Definition font_osx.cpp:214
CFAutoRelease< CTFontDescriptorRef > font_desc
Font descriptor excluding font size.
Definition font_osx.h:19
std::string font_name
Cached font name.
Definition font_osx.h:22
CFAutoRelease< CTFontRef > font
CoreText font handle.
Definition font_osx.h:20
void ClearFontCache() override
Reset cached glyphs.
Definition font_osx.cpp:34
GlyphID MapCharToGlyph(char32_t key, bool allow_fallback=true) override
Map a character into a glyph.
Definition font_osx.cpp:97
Factory for FontCaches.
Definition fontcache.h:220
int height
The height of the font.
Definition fontcache.h:27
std::unique_ptr< FontCache > parent
The parent of this font cache.
Definition fontcache.h:25
const FontSize fs
The size of the font.
Definition fontcache.h:26
int descender
The descender value of the font.
Definition fontcache.h:29
int ascender
The ascender value of the font.
Definition fontcache.h:28
A searcher for missing glyphs.
bool FindMissingGlyphs()
Check whether there are glyphs missing in the current language.
Definition strings.cpp:2278
virtual void SetFontNames(struct FontCacheSettings *settings, std::string_view font_name, const void *os_data=nullptr)=0
Set the right font names.
virtual bool Monospace()=0
Whether to search for a monospace font or not.
Map zoom level to data.
virtual Sprite * Encode(SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator)=0
Convert a sprite from the loader to our own format.
Font cache for fonts that are based on a TrueType font.
static constexpr int MAX_GLYPH_DIM
Maximum glyph dimensions.
int used_size
Used font size.
int req_size
Requested font size.
void ClearFontCache() override
Reset cached glyphs.
static constexpr uint MAX_FONT_MIN_REC_SIZE
Upper limit for the recommended font size in case a font file contains nonsensical values.
SpriteAllocator that allocates memory via a unique_ptr array.
Definition spritecache.h:20
#define Debug(category, level, format_string,...)
Output a line of debugging information.
Definition debug.h:37
bool FileExists(std::string_view filename)
Test whether the given filename exists.
Definition fileio.cpp:132
std::string FioFindFullPath(Subdirectory subdir, std::string_view filename)
Find a path to the filename in one of the search directories.
Definition fileio.cpp:144
@ BASE_DIR
Base directory for all subdirectories.
Definition fileio_type.h:89
fluid_settings_t * settings
FluidSynth settings handle.
Functions related to font handling on MacOS.
uint GetFontCacheFontSize(FontSize fs)
Get the scalable font size to use for a FontSize.
std::string GetFontCacheFontName(FontSize fs)
Get font to use for a given font size.
FontType
Different types of font that can be loaded.
Definition fontcache.h:214
@ TrueType
Scalable TrueType fonts.
FontCacheSubSetting * GetFontCacheSubSetting(FontSize fs)
Get the settings of a given font size.
Definition fontcache.h:196
uint32_t GlyphID
Glyphs are characters from a font.
Definition fontcache.h:18
@ Font
A sprite used for fonts.
FontSize
Available font sizes.
Definition gfx_type.h:249
@ FS_SMALL
Index of the small font in the font tables.
Definition gfx_type.h:251
@ FS_NORMAL
Index of the normal font in the font tables.
Definition gfx_type.h:250
Functions related to MacOS support.
std::unique_ptr< typename std::remove_pointer< T >::type, CFDeleter< typename std::remove_pointer< T >::type > > CFAutoRelease
Specialisation of std::unique_ptr for CoreFoundation objects.
Definition macos.h:54
bool MacOSVersionIsAtLeast(long major, long minor, long bugfix)
Check if we are at least running on the specified version of Mac OS.
Definition macos.h:25
constexpr T Align(const T x, uint n)
Return the smallest multiple of n equal or greater than x.
Definition math_func.hpp:37
@ Palette
Sprite has palette data.
@ Alpha
Sprite has alpha.
#define lengthof(array)
Return the length of an fixed size array.
Definition stdafx.h:271
Settings for the four different fonts.
Definition fontcache.h:180
Settings for a single font.
Definition fontcache.h:172
uint8_t m
Remap-channel.
uint8_t a
Alpha-channel.
Structure for passing information from the sprite loader to the blitter.
SpriteComponents colours
The colour components of the sprite with useful information.
void AllocateData(ZoomLevel zoom, size_t size)
Allocate the sprite data of this sprite.
uint16_t width
Width of the sprite.
int16_t x_offs
The x-offset of where the sprite will be drawn.
SpriteLoader::CommonPixel * data
The sprite itself.
uint16_t height
Height of the sprite.
int16_t y_offs
The y-offset of where the sprite will be drawn.
Data structure describing a sprite.
std::byte data[]
Sprite data.
static const int MAX_FONT_SIZE
Maximum font size.
static RectPadding ScaleGUITrad(const RectPadding &r)
Scale a RectPadding to GUI zoom level.
Definition widget.cpp:49
@ Min
Minimum zoom level.