Working with fonts and chars (⬤) in Win forms and OS versions, 10 compared to 7
-
I wrote an app in Win Forms, and I'm using a circle in ListView, as a pleasant indicator. On my rigs, running Win 10 at home and 11 at the office, the ⬤ char works no problem. But on the customers computers running Win 7, I get the tall square symbol. So I changed the Font in my Win Forms App to Segoe UI, which looks nice, but I still get the tall rectangle. I checked the customers computers to see what fonts are loaded, and Segoe UI is there. Then I did research, and a few online posts talk about font searching by the OS, which dates back to Windows XP. If the Char ⬤ doesn't exists in the Font file, the OS will search for that char in other font files, such as webdings.ttf. Found a post about using the RegEdit /LocalMachine/Software/WindowsNt/Fonts and having to edit font mappings, which looked complicated. ChatGpt says that I can MeasureText, to see if a char exists, and if not choose another char sysmbol.But the char always exists.
Dim font As New Font("Segoe UI", 9, FontStyle.Regular)
' The character you want to check (e.g., the copyright symbol ©)
Dim specialChar As Char = "⬤"' Check if the font can display the character
Dim canDisplayChar As Boolean = TextRenderer.MeasureText(specialChar, font).Width > 0
If canDisplayChar Then
Return "⬤"
Else
Return "X"
End IfI'm just wondering if someone here has figured this out, and can share what they did. The customer really wants the ⬤. On a side note or question, I can set a color for the circle in ListView on .Net Core 7, but can't set the color of the circle in .Net Framework 4.6.1.
If it ain't broke don't fix it Discover my world at jkirkerx.com
-
I wrote an app in Win Forms, and I'm using a circle in ListView, as a pleasant indicator. On my rigs, running Win 10 at home and 11 at the office, the ⬤ char works no problem. But on the customers computers running Win 7, I get the tall square symbol. So I changed the Font in my Win Forms App to Segoe UI, which looks nice, but I still get the tall rectangle. I checked the customers computers to see what fonts are loaded, and Segoe UI is there. Then I did research, and a few online posts talk about font searching by the OS, which dates back to Windows XP. If the Char ⬤ doesn't exists in the Font file, the OS will search for that char in other font files, such as webdings.ttf. Found a post about using the RegEdit /LocalMachine/Software/WindowsNt/Fonts and having to edit font mappings, which looked complicated. ChatGpt says that I can MeasureText, to see if a char exists, and if not choose another char sysmbol.But the char always exists.
Dim font As New Font("Segoe UI", 9, FontStyle.Regular)
' The character you want to check (e.g., the copyright symbol ©)
Dim specialChar As Char = "⬤"' Check if the font can display the character
Dim canDisplayChar As Boolean = TextRenderer.MeasureText(specialChar, font).Width > 0
If canDisplayChar Then
Return "⬤"
Else
Return "X"
End IfI'm just wondering if someone here has figured this out, and can share what they did. The customer really wants the ⬤. On a side note or question, I can set a color for the circle in ListView on .Net Core 7, but can't set the color of the circle in .Net Framework 4.6.1.
If it ain't broke don't fix it Discover my world at jkirkerx.com
What you "see" depends on the font of your "IDE"; what shows up at run time, is another matter (when you use "strings" for characters). Try "character codes". [https://stackoverflow.com/questions/3144053/how-to-represent-unicode-character-in-vb-net-string-literal\](https://stackoverflow.com/questions/3144053/how-to-represent-unicode-character-in-vb-net-string-literal)
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
-
What you "see" depends on the font of your "IDE"; what shows up at run time, is another matter (when you use "strings" for characters). Try "character codes". [https://stackoverflow.com/questions/3144053/how-to-represent-unicode-character-in-vb-net-string-literal\](https://stackoverflow.com/questions/3144053/how-to-represent-unicode-character-in-vb-net-string-literal)
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
I had to think about that for a couple of minutes. So instead of blaming the OS, I should consider the code, and use a character code. I'll try that. Thanks!
If it ain't broke don't fix it Discover my world at jkirkerx.com
-
What you "see" depends on the font of your "IDE"; what shows up at run time, is another matter (when you use "strings" for characters). Try "character codes". [https://stackoverflow.com/questions/3144053/how-to-represent-unicode-character-in-vb-net-string-literal\](https://stackoverflow.com/questions/3144053/how-to-represent-unicode-character-in-vb-net-string-literal)
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
That got complicated, and resulted in showing a "n" Decided to use these chars in string form, and it works for now ❶❷ they are in Segoe UI
If it ain't broke don't fix it Discover my world at jkirkerx.com
-
That got complicated, and resulted in showing a "n" Decided to use these chars in string form, and it works for now ❶❷ they are in Segoe UI
If it ain't broke don't fix it Discover my world at jkirkerx.com
You said you wanted to use Segoe UI Symbol; which means that has to be the font specified in your "UI" when you use (hex) codes for "special" characters in that font. The "symbol font" in fact contains numerous "black circles" of various sizes (or the same size). You can't just pick "any" black circle and expect it to show up in "any" font. In my app, I mix all "4" Segoe fonts (MDL2, UI, Symbol, Emoji) at the same time and never have any issues: character code + font family.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
-
You said you wanted to use Segoe UI Symbol; which means that has to be the font specified in your "UI" when you use (hex) codes for "special" characters in that font. The "symbol font" in fact contains numerous "black circles" of various sizes (or the same size). You can't just pick "any" black circle and expect it to show up in "any" font. In my app, I mix all "4" Segoe fonts (MDL2, UI, Symbol, Emoji) at the same time and never have any issues: character code + font family.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
I get it now! I selected the wrong font file, and can use Segoe UI Symbols, which has the large circle, and alphanumeric chars as well. So I don't have to compromise now, and can finish as planned. Realize my UI goal or vision. So this font style and font file solves my issue and is the correct fix. And I should not depend on Windows or the OS to do font searching and swapping for me, because it's unreliable. Wow, I put so much effort into trying to solve this and it was very hard. Thank you Gary for putting me on the right track, and pushing me to get it right and not compromise for something sub standard.
If it ain't broke don't fix it Discover my world at jkirkerx.com
-
I get it now! I selected the wrong font file, and can use Segoe UI Symbols, which has the large circle, and alphanumeric chars as well. So I don't have to compromise now, and can finish as planned. Realize my UI goal or vision. So this font style and font file solves my issue and is the correct fix. And I should not depend on Windows or the OS to do font searching and swapping for me, because it's unreliable. Wow, I put so much effort into trying to solve this and it was very hard. Thank you Gary for putting me on the right track, and pushing me to get it right and not compromise for something sub standard.
If it ain't broke don't fix it Discover my world at jkirkerx.com
You're welcome. And the "black circles" aren't really "black"; that's the default "foreground" color; you can change it to any color you want. That applies that "all" characters. If you want a different color for the background, it has to come from the object "behind" it. "Characters" have no background color you can set. Emoji is colored by default and you can't change that. You can layer characters to "insert" a color into (say) a "hollow circle" with a "solid colored circle" behind it (so as not have to put another "background" behind). And you can rotate individual characters (e.g. pointing arrows)
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
-
You're welcome. And the "black circles" aren't really "black"; that's the default "foreground" color; you can change it to any color you want. That applies that "all" characters. If you want a different color for the background, it has to come from the object "behind" it. "Characters" have no background color you can set. Emoji is colored by default and you can't change that. You can layer characters to "insert" a color into (say) a "hollow circle" with a "solid colored circle" behind it (so as not have to put another "background" behind). And you can rotate individual characters (e.g. pointing arrows)
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
I was pretty excited and thought I had it all figured out, only to be proven wrong again, where I got ".." which is 2 dots. target computer is a Win 7 32 bit OS, My "Extras" app is targeted at Framework 4.6.1. I got the code from Charmap; U+2824 Black Large Circle. On my rig it works great. With my other Win Forms app called "Simple BOL" using .Net Core 7 I think, I can change the forecolor of a ListView cell or column, and make red, black and green circles on my rig running Win 11 64. But on these Win 7 32 bit OS machines with the app in question called "Extras", no luck either. In fact on my machine with Extras, the forecolor for a target cell won't change colors either. So another swing and a miss for strike 3 now, batter out. Well I still have plenty of innings left in the game, so I'll try again tomorrow.
If it ain't broke don't fix it Discover my world at jkirkerx.com
-
I was pretty excited and thought I had it all figured out, only to be proven wrong again, where I got ".." which is 2 dots. target computer is a Win 7 32 bit OS, My "Extras" app is targeted at Framework 4.6.1. I got the code from Charmap; U+2824 Black Large Circle. On my rig it works great. With my other Win Forms app called "Simple BOL" using .Net Core 7 I think, I can change the forecolor of a ListView cell or column, and make red, black and green circles on my rig running Win 11 64. But on these Win 7 32 bit OS machines with the app in question called "Extras", no luck either. In fact on my machine with Extras, the forecolor for a target cell won't change colors either. So another swing and a miss for strike 3 now, batter out. Well I still have plenty of innings left in the game, so I'll try again tomorrow.
If it ain't broke don't fix it Discover my world at jkirkerx.com
U+2824 is NOT a "circle"; it is a "Braille Pattern Dots-36" in the "Segoe UI Symbol" font (i.e. 2 "dots"). It is exactly what it is.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
-
U+2824 is NOT a "circle"; it is a "Braille Pattern Dots-36" in the "Segoe UI Symbol" font (i.e. 2 "dots"). It is exactly what it is.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
That sounds encouraging, but that's the code Character Map presents to me on both my computers. Hmm... I have U+28C0 for the braille code of 2 dots Braille Pattern Dots 78 Mind if I ask what code you have for the Large Black Circle?
If it ain't broke don't fix it Discover my world at jkirkerx.com
-
That sounds encouraging, but that's the code Character Map presents to me on both my computers. Hmm... I have U+28C0 for the braille code of 2 dots Braille Pattern Dots 78 Mind if I ask what code you have for the Large Black Circle?
If it ain't broke don't fix it Discover my world at jkirkerx.com
You talk codes without font names; which is meaningless. It should be a simple matter for you to compare the character maps of "both operating systems" and draw your own conclusions.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
-
You talk codes without font names; which is meaningless. It should be a simple matter for you to compare the character maps of "both operating systems" and draw your own conclusions.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
U+2B24 - I thought the B was an 8 in Segoe UI Symbol.
If it ain't broke don't fix it Discover my world at jkirkerx.com
-
You talk codes without font names; which is meaningless. It should be a simple matter for you to compare the character maps of "both operating systems" and draw your own conclusions.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
Finally got it working today. Thanks for the help, I learned a lot on this and your input made things clearer. This ended up being a deep lesson on Fonts and Chars for me, and will make coding more fun in the future, using some emojis to brighten things up a bit. Thanks Gerry! I just need to get some glasses pretty soon.
If it ain't broke don't fix it Discover my world at jkirkerx.com
-
I wrote an app in Win Forms, and I'm using a circle in ListView, as a pleasant indicator. On my rigs, running Win 10 at home and 11 at the office, the ⬤ char works no problem. But on the customers computers running Win 7, I get the tall square symbol. So I changed the Font in my Win Forms App to Segoe UI, which looks nice, but I still get the tall rectangle. I checked the customers computers to see what fonts are loaded, and Segoe UI is there. Then I did research, and a few online posts talk about font searching by the OS, which dates back to Windows XP. If the Char ⬤ doesn't exists in the Font file, the OS will search for that char in other font files, such as webdings.ttf. Found a post about using the RegEdit /LocalMachine/Software/WindowsNt/Fonts and having to edit font mappings, which looked complicated. ChatGpt says that I can MeasureText, to see if a char exists, and if not choose another char sysmbol.But the char always exists.
Dim font As New Font("Segoe UI", 9, FontStyle.Regular)
' The character you want to check (e.g., the copyright symbol ©)
Dim specialChar As Char = "⬤"' Check if the font can display the character
Dim canDisplayChar As Boolean = TextRenderer.MeasureText(specialChar, font).Width > 0
If canDisplayChar Then
Return "⬤"
Else
Return "X"
End IfI'm just wondering if someone here has figured this out, and can share what they did. The customer really wants the ⬤. On a side note or question, I can set a color for the circle in ListView on .Net Core 7, but can't set the color of the circle in .Net Framework 4.6.1.
If it ain't broke don't fix it Discover my world at jkirkerx.com
Working with fonts and characters in Windows Forms applications can indeed vary between different Windows OS versions. Windows 10 introduced several improvements and changes in font rendering and character support compared to Windows 7. Here are some key points to consider: Font Rendering: Windows 10 introduced improvements in font rendering, offering better ClearType and subpixel rendering. This results in crisper and more visually pleasing text. Windows 7 also supports ClearType, but Windows 10 may offer a more refined experience. Font Compatibility: Windows 10 typically supports a wider range of fonts and character sets out of the box, including enhanced support for Unicode characters. This can be important if your application involves internationalization or special symbols like ⬤. DPI Scaling: Windows 10 has better support for high-DPI displays, allowing for more precise scaling of fonts and user interface elements. This can be crucial for ensuring your application looks good on modern high-resolution screens. Theme and UI Elements: Windows 10 offers a more modern and flexible user interface framework compared to Windows 7. This may affect the appearance of your WinForms application, including how fonts and characters are rendered within the UI elements. Compatibility Modes: Windows 10 includes compatibility modes that allow you to run older Windows 7 applications without significant issues. However, it's still essential to test your application on different OS versions to ensure proper functionality. for more info visit my page MOFA Attestation | MoFAIC | MOFA Attestation in Dubai[^] Mofa atteststation in Dubai