[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Changing control font size
From: |
Fred Kiefer |
Subject: |
Re: Changing control font size |
Date: |
Thu, 23 Sep 2021 18:49:20 +0200 |
> Am 23.09.2021 um 13:19 schrieb Andreas Höschler <ahoesch@smartsoft.de>:
>
>
>> Ignore that list. The only defined font sizes in the defaults are
>> @„NSFontSize“, @„NSLabelFontSize“ and @„NSSmallFontSize“. You have to use
>> these strings if you want to set this programmatically
>
> I have done
>
> - (void)applicationDidFinishLaunching
> {
> #ifndef __APPLE__
> [[NSUserDefaults standardUserDefaults] setObject:[NSNumber
> numberWithFloat:20.0] forKey:@"NSFontSize"];
> [[NSUserDefaults standardUserDefaults] setObject:[NSNumber
> numberWithFloat:20.0] forKey:@"NSLabelFontSize"];
> #endif
> ....
> }
>
> but this does not seem to have changed anything. The font used by TableViews,
> ComboBoxes, TextFields and Buttons is still the same!?
Thinking about this a bit gave me a hint. Do the elements with the wrong font
size come from a Gorm or NIB file? When encoding a font object we store its
actual size and when regenerating the font we use that size. This is of course
wrong. We should store the standard size as 0, so that the current standard
size gets used when recreating the object. This is easy to change in the code,
still all old NIB and Gorm files will behave wrong. We could try to treat 12
the same as 0 when decoding. But this both won’t work for label and small
system font size.
Anybody with a better idea out there?
>> but most likely it is easier to set them via the defaults file once.
>
> You mean
>
> defaults write ScaleMaster NSFontSize 20
> defaults write ScaleMaster NSLabelFontSize 20
Yes, that is what I was suggesting.
Fred