# Font size issue on MacOS

**URL:** <https://ifnotnil.com/t/font-size-issue-on-macos/3794>\
**Category:** Xojo\
**Tags:** xojo\
**Created:** [29 January 2024 15:57 UTC](https://ifnotnil.com/t/font-size-issue-on-macos/3794 "2024-01-29T15:57:21Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Meestor\_X](https://ifnotnil.com/user_avatar/ifnotnil.com/meestor_x/32/567_2.png) [@Meestor\_X](https://ifnotnil.com/u/Meestor_X)\
**Post date:** [29 January 2024 15:57 UTC](https://ifnotnil.com/t/font-size-issue-on-macos/3794/1 "2024-01-29T15:57:21Z")

</div>

I wrote some software many years ago, and while it’s had small updates over the years, not much else has changed. It’s been downloaded and installed 1000’s of times by users around the world, but today I had a customer report an issue I’ve never seen before.  
Some of the font sizes in my app are larger on his computer than on mine, and they’re messing up the layout. I’ve seen this issue with many programs under Windows, when people set their fonts to 125% and so on, but this issue is on **MacOS**.  
He is running Sonoma, as am I, and I cannot reproduce the issue. I don’t see any settings in Sonoma that allow for larger text except in specific Apple-only applications, so I don’t think it’s that. Could it be HiDPI settings? The app doesn’t look great with HiDPI disabled, so hopefully not!

Here’s what it’s supposed to look like:

 ![image](https://ifnotnil.com/uploads/default/original/2X/e/e825b46baf019083e0775dcb15c623409bef8259.png)

Here’s what it looks like on his machine:  
 ![image](https://ifnotnil.com/uploads/default/original/2X/4/4c678d8b10958bfe1a2fb4deeb34e79bd0f4973b.png)

Note that ONLY the Listbox column headers and Tab header text is larger. Other fonts are (from what I can see) the same size. The whole listbox is in Courier, with the header bolded, but the Tab labels are just system font. All fonts are set to “0” for size.

Scratching my head on this one!

---

<div class="post-metadata">

**Author:** ![Meestor\_X](https://ifnotnil.com/user_avatar/ifnotnil.com/meestor_x/32/567_2.png) [@Meestor\_X](https://ifnotnil.com/u/Meestor_X)\
**Post date:** [29 January 2024 16:11 UTC](https://ifnotnil.com/t/font-size-issue-on-macos/3794/2 "2024-01-29T16:11:56Z")

</div>

Another pic with the 2 windows the same size.  
Clearly everything in the Tabs control is larger (Tab text and Listbox text), but the rest of the window is normal.

 ![KBS Editor Font anomoly 1](https://ifnotnil.com/uploads/default/original/2X/8/89cb89bc9a22395c016dc4c0f0945ae3d6151a77.png)

---

<div class="post-metadata">

**Author:** ![samRowlands](https://ifnotnil.com/user_avatar/ifnotnil.com/samrowlands/32/121_2.png) [@samRowlands](https://ifnotnil.com/u/samRowlands)\
**Post date:** [30 January 2024 00:24 UTC](https://ifnotnil.com/t/font-size-issue-on-macos/3794/3 "2024-01-30T00:24:14Z")

</div>

This is possible and I’ll be honest, I never looked for the settings myself, but I often get e-mails about text being cut off and things just looking like crap, because the font is way too big.

I am thankful that with SwiftUI, you don’t layout things out by pixel, so if the user has overridden the font size, the UI still works, unless you force it not too!

Here’s an Apple guide on how to do it.

> **[Make text and other items on the screen bigger on Mac](https://support.apple.com/guide/mac-help/text-items-screen-bigger-mchld786f2cd/mac)**
>
> On your Mac, change the display resolution to make everything on the screen bigger, or increase the size of text and icons to make them easier to see.

---

<div class="post-metadata">

**Author:** ![Meestor\_X](https://ifnotnil.com/user_avatar/ifnotnil.com/meestor_x/32/567_2.png) [@Meestor\_X](https://ifnotnil.com/u/Meestor_X)\
**Post date:** [30 January 2024 05:26 UTC](https://ifnotnil.com/t/font-size-issue-on-macos/3794/4 "2024-01-30T05:26:51Z")

</div>

Thanks, Sam, but that’s not it. There’s settings for only a few Apple programs - Calendar, Mail, etc, but no others.  
Other apps have to handle it within that app if they want to give that control.  
On my computer, here’s the only 5 programs that allow for text size to be adjusted:

 ![image](https://ifnotnil.com/uploads/default/original/2X/9/954dc179a42b5b3b474ed9f2035299912a009bc4.jpeg)

---

<div class="post-metadata">

**Author:** ![MarkusWinter](https://ifnotnil.com/user_avatar/ifnotnil.com/markuswinter/32/32_2.png) [@MarkusWinter](https://ifnotnil.com/u/MarkusWinter)\
**Post date:** [30 January 2024 18:54 UTC](https://ifnotnil.com/t/font-size-issue-on-macos/3794/5 "2024-01-30T18:54:54Z")

</div>

Check that he actually has the font. He might have removed or disabled it, so you’ll get font substitution.

---

<div class="post-metadata">

**Author:** ![Meestor\_X](https://ifnotnil.com/user_avatar/ifnotnil.com/meestor_x/32/567_2.png) [@Meestor\_X](https://ifnotnil.com/u/Meestor_X)\
**Post date:** [30 January 2024 19:30 UTC](https://ifnotnil.com/t/font-size-issue-on-macos/3794/6 "2024-01-30T19:30:06Z")

</div>

Well, that could happen for the courier font, but there’s a couple of things:

1. The font on his screen is still courier, just larger.
2. The tab control font is “system” and still shows larger.
3. The other fonts on that window are all “system” and are not larger.

---

<div class="post-metadata">

**Author:** ![Meestor\_X](https://ifnotnil.com/user_avatar/ifnotnil.com/meestor_x/32/567_2.png) [@Meestor\_X](https://ifnotnil.com/u/Meestor_X)\
**Post date:** [31 January 2024 17:03 UTC](https://ifnotnil.com/t/font-size-issue-on-macos/3794/7 "2024-01-31T17:03:39Z")

</div>

When you select a font size of 0, will that ALWAYS translate to 12 points (Mac & Windows) or does a user have control over that?  
If it’s not ALWAYS 12 points, then how do you get what size the user has selected?

---

<div class="post-metadata">

**Author:** ![npalardy](https://ifnotnil.com/user_avatar/ifnotnil.com/npalardy/32/10_2.png) [@npalardy](https://ifnotnil.com/u/npalardy)\
**Post date:** [31 January 2024 18:24 UTC](https://ifnotnil.com/t/font-size-issue-on-macos/3794/8 "2024-01-31T18:24:11Z")

</div>

Size 0 is “the systems default size” in Xojo  
And this varies depending on whether you you Small System or System as the font (Small system on macOS seems to be about 9 point and System seems to be about 11 pt)  
Users have some control over that in various appearance panes  
System Settings \> Accessibility \> Display \> Text  
Not sure where that is on Windows TBH

What I’ve seen people do to get the actual selected size is

1. declares
2. plugins
3. graphics.textsize (see [SmallSystem font size - Windows - Xojo Programming Forum](https://forum.xojo.com/t/smallsystem-font-size/23637))
4. other silly hackery to draw text in to a picture then measure the height in pixels

Personally 1 or 2 is the most likely to be accurate

EDIT : I suspect its something like

```auto
Function TextSizeToUse( font_name as string, text_size as integer) as double

	dim font_size_to_use as double = text_size
	
	if font_name = "System" or font_name = "" then
		if font_size_to_use = 0 then
			font_size_to_use = declare into [NSFont systemFontSizeForControlSize:NSRegularControlSize]
		end if
				
	elseif font_name = "SmallSystem" then
		if font_size_to_use = 0
			font_size_to_use = declare into [NSFont systemFontSizeForControlSize:NSSmallControlSize];
		end if
	end if	

	return font_size_to_use
end Function

```

and this along with the font name is then used to get the right font at the right size using one of NSFont functions like

```auto
[NSFont systemFontSizeForControlSize:NSRegularControlSize]; // font name = "System" or ""
[NSFont systemFontSizeForControlSize:NSSmallControlSize]; // font name = "SmallSystem"
[NSFont fontWithName:font_name size:text_size]; // for any other font & size 

```

see [NSFont | Apple Developer Documentation](https://developer.apple.com/documentation/appkit/nsfont)

---

<div class="post-metadata">

**Author:** ![samRowlands](https://ifnotnil.com/user_avatar/ifnotnil.com/samrowlands/32/121_2.png) [@samRowlands](https://ifnotnil.com/u/samRowlands)\
**Post date:** [1 February 2024 00:20 UTC](https://ifnotnil.com/t/font-size-issue-on-macos/3794/9 "2024-02-01T00:20:14Z")

</div>

> [@Meestor\_X](#):
>
> If it’s not ALWAYS 12 points, then how do you get what size the user has selected?

In Xojo… Declares.

NSFont.systemFontSize

> **[systemFontSize | Apple Developer Documentation](https://developer.apple.com/documentation/appkit/nsfont/1531931-systemfontsize)**
>
> Returns the size of the standard system font.

And

> **[smallSystemFontSize | Apple Developer Documentation](https://developer.apple.com/documentation/appkit/nsfont/1535612-smallsystemfontsize)**
>
> Returns the size of the standard small system font.

---

<div class="post-metadata">

**Author:** ![Torsten\_B](https://ifnotnil.com/letter_avatar_proxy/v4/letter/t/ecae2f/32.png) [@Torsten\_B](https://ifnotnil.com/u/Torsten_B)\
**Post date:** [1 February 2024 08:09 UTC](https://ifnotnil.com/t/font-size-issue-on-macos/3794/10 "2024-02-01T08:09:05Z")

</div>

In SwiftUI virtually everything that can be modified at code level is conveniently accessible through modifiers.

It is unfortunate that Xojo does not offer the same RAD environment and everyone needs to dabble in declares.

---

<div class="post-metadata">

**Author:** ![Meestor\_X](https://ifnotnil.com/user_avatar/ifnotnil.com/meestor_x/32/567_2.png) [@Meestor\_X](https://ifnotnil.com/u/Meestor_X)\
**Post date:** [1 February 2024 21:42 UTC](https://ifnotnil.com/t/font-size-issue-on-macos/3794/11 "2024-02-01T21:42:15Z")

</div>

> [@npalardy](#):
>
> Users have some control over that in various appearance panes  
> System Settings \> Accessibility \> Display \> Text

Adjusting that doesn’t seem to change anything within the Xojo app. Should it?

---

<div class="post-metadata">

**Author:** ![samRowlands](https://ifnotnil.com/user_avatar/ifnotnil.com/samrowlands/32/121_2.png) [@samRowlands](https://ifnotnil.com/u/samRowlands)\
**Post date:** [2 February 2024 01:01 UTC](https://ifnotnil.com/t/font-size-issue-on-macos/3794/12 "2024-02-02T01:01:29Z")

</div>

> [@Meestor\_X](#):
>
> Adjusting that doesn’t seem to change anything within the Xojo app. Should it?

That’s the kicker, I don’t know. First of all, I don’t know what information that option changes and secondly, we don’t know where Xojo is getting the font size from, and thirdly Xojo likes to cache things, so you may have to restart your app to see any difference (like date and time formatting).

Next time I get a customer feedback (where they’ve made the fonts ginormous), I’mma gonna have to ask how they did it.

---

<div class="post-metadata">

**Author:** ![npalardy](https://ifnotnil.com/user_avatar/ifnotnil.com/npalardy/32/10_2.png) [@npalardy](https://ifnotnil.com/u/npalardy)\
**Post date:** [2 February 2024 05:17 UTC](https://ifnotnil.com/t/font-size-issue-on-macos/3794/13 "2024-02-02T05:17:16Z")

</div>

Well assuming Xojo is using the correct macOS functions for getting the right size I might assume it would
