Help needed - font problem

13 views
Skip to first unread message

S.E. Mitchell

unread,
Jun 14, 2022, 10:26:34 PM6/14/22
to TSEPro Support
A user in China is having a font issue.

He can set the Fixedsys font by using the SetFont menu.

However, if he uses SetFont("Fixedsys", 9, 0) (and many
variations), the font is set to Arial or Courier New, but
not to Fixedsys.

I'm trying to figure out why he can't set Fixedsys with
SetFont("Fixedsys", ...).

Carlo Hogeveen wrote a neat macro that I've hacked up to
explore this problem.

If you have a non-English version of Windows, can you:

* Set your font to Courier New
* Run the attached macro
* Reply to this message with the resulting output
(Note that this macro does not change your TSE font)

For instance, if I run it, I get:

TSE font properties:
Name Courier New
Size 9
Flags 0
Width 7
Height 15

Newly created font properties:
Name Fixedsys

GetTextMetrics properties:
tmHeight=15
tmAscent=12
tmDescent=3
tmInternalLeading=3
tmExternalLeading=0
tmAveCharWidth=8
tmMaxCharWidth=8
tmWeight=400
tmOverhang=0
tmDigitizedAspectX=96
tmDigitizedAspectY=96
tmFirstChar=32
tmLastChar=255
tmDefaultChar=128
tmBreakChar=32
tmItalic=0
tmUnderLined=0
tmStruckOut=0
tmPitchAndFamily=48
tmCharSet=0

However, the user gets:

TSE font properties:
Name Courier New
Size 10
Flags 0
Width 8
Height 16

Newly created font properties:
Name Arial

GetTextMetrics properties:
tmHeight=12
tmAscent=9
tmDescent=3
tmInternalLeading=3
tmExternalLeading=0
tmAveCharWidth=7
tmMaxCharWidth=40
tmWeight=400
tmOverhang=0
tmDigitizedAspectX=96
tmDigitizedAspectY=96
tmFirstChar=30
tmLastChar=255
tmDefaultChar=31
tmBreakChar=32
tmItalic=0
tmUnderLined=0
tmStruckOut=0
tmPitchAndFamily=39
tmCharSet=0
--
Sammy Mitchell
setfont.zip

Guy Rouillier

unread,
Jun 15, 2022, 4:02:02 AM6/15/22
to TSEPro Support
I played around with this a bit. Here's what I found:

SetFont("Fixedsys", 0x080f, _FONT_OEM_) // sets wrong font BatangChe
SetFont("Fixedsys", 0x080f) // works
SetFont("Fixedsys", 9) // works
SetFont("Fixedsys", 9, _FONT_OEM_) // sets wrong font BatangChe
SetFont("Fixedsys", 9, 0) // works
SetFont("Fixedsys", 11, 0) // works, same size font as 9

I don't know if this helps, but the _FONT_OEM_ seems to mess up font
selection.

Also, on my system (Windows 7 Pro), only Fixedsys 9 is available; I
tried different sizes, thinking that perhaps when it couldn't match on
size, it might select a different font. Oddly, it picks the correct
font but lies about the size. :) When I ran your setfont.s macro after
that last SetFont with size 11, it reports:

Name Fixedsys
Size 11
Flags 0
Width 8
Height 15

The width and height are the same reported for size 9, and looking at
them side by side, the two are exactly the same. For those following
along, I also discovered the font name appears not to be case sensitive;
Fixedsys, FixedSys, and fixedSYS all worked.

Finally, in the Help for SetFont, I found the discussion of the "magic
formula" confusing. I think it would be more clear to simply state to
use a 2-digit width followed by a 2-digit height.

Hope this helps.

--
Guy Rouillier

On 6/14/2022 10:26:18 PM, "S.E. Mitchell" <sammy.m...@gmail.com>
wrote:
>--
>--- You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
>To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
>To view this discussion on the web visit https://groups.google.com/d/msgid/semware/CA%2BgEvkYOYhc7CUEjFKpu0%2BjMegxCDMEaoLpMi%3Dr%3D0UqDQT5g9g%40mail.gmail.com.

Eckhard Hillmann

unread,
Jun 15, 2022, 5:31:11 AM6/15/22
to S.E. Mitchell
Hello,

I am using the German version of Windows 10 x64, latest patches.

Here is what I get when settings are at size 9 and size 12.

--------------------
Size 9
--------------------
--------------------
Size 12
--------------------

TSE font properties:
Name Courier New
Size 12
Flags 0
Width 10
Height 18

Newly created font properties:
Name Fixedsys

GetTextMetrics properties:
tmHeight=15
tmAscent=12
tmDescent=3
tmInternalLeading=3
tmExternalLeading=0
tmAveCharWidth=8
tmMaxCharWidth=8
tmWeight=400
tmOverhang=0
tmDigitizedAspectX=96
tmDigitizedAspectY=96
tmFirstChar=32
tmLastChar=255
tmDefaultChar=128
tmBreakChar=32
tmItalic=0
tmUnderLined=0
tmStruckOut=0
tmPitchAndFamily=48
tmCharSet=0


I hope this is of any use to you.

--
Regards
Eckhard Hillmann


Ihre Nachricht vom Mittwoch, 15. Juni 2022 04:26:

SEM> A user in China is having a font issue.

SEM> He can set the Fixedsys font by using the SetFont menu.

SEM> However, if he uses SetFont("Fixedsys", 9, 0) (and many
SEM> variations), the font is set to Arial or Courier New, but
SEM> not to Fixedsys.

SEM> I'm trying to figure out why he can't set Fixedsys with
SEM> SetFont("Fixedsys", ...).

SEM> Carlo Hogeveen wrote a neat macro that I've hacked up to
SEM> explore this problem.

SEM> If you have a non-English version of Windows, can you:

SEM> * Set your font to Courier New
SEM> * Run the attached macro
SEM> * Reply to this message with the resulting output
SEM> (Note that this macro does not change your TSE font)

SEM> For instance, if I run it, I get:

SEM> TSE font properties:
SEM> Name Courier New
SEM> Size 9
SEM> Flags 0
SEM> Width 7
SEM> Height 15

SEM> Newly created font properties:
SEM> Name Fixedsys

SEM> GetTextMetrics properties:
SEM> tmHeight=15
SEM> tmAscent=12
SEM> tmDescent=3
SEM> tmInternalLeading=3
SEM> tmExternalLeading=0
SEM> tmAveCharWidth=8
SEM> tmMaxCharWidth=8
SEM> tmWeight=400
SEM> tmOverhang=0
SEM> tmDigitizedAspectX=96
SEM> tmDigitizedAspectY=96
SEM> tmFirstChar=32
SEM> tmLastChar=255
SEM> tmDefaultChar=128
SEM> tmBreakChar=32
SEM> tmItalic=0
SEM> tmUnderLined=0
SEM> tmStruckOut=0
SEM> tmPitchAndFamily=48
SEM> tmCharSet=0

SEM> However, the user gets:

SEM> TSE font properties:
SEM> Name Courier New
SEM> Size 10
SEM> Flags 0
SEM> Width 8
SEM> Height 16

SEM> Newly created font properties:
SEM> Name Arial

SEM> GetTextMetrics properties:
SEM> tmHeight=12
SEM> tmAscent=9
SEM> tmDescent=3
SEM> tmInternalLeading=3
SEM> tmExternalLeading=0
SEM> tmAveCharWidth=7
SEM> tmMaxCharWidth=40
SEM> tmWeight=400
SEM> tmOverhang=0
SEM> tmDigitizedAspectX=96
SEM> tmDigitizedAspectY=96
SEM> tmFirstChar=30
SEM> tmLastChar=255
SEM> tmDefaultChar=31
SEM> tmBreakChar=32
SEM> tmItalic=0
SEM> tmUnderLined=0
SEM> tmStruckOut=0
SEM> tmPitchAndFamily=39
SEM> tmCharSet=0
SEM> --
SEM> Sammy Mitchell

Carlo Hogeveen

unread,
Jun 15, 2022, 5:41:48 AM6/15/22
to sem...@googlegroups.com

Some suggestions:

Since the Windows function does work, it might be interesting to see what TSE's ChooseFont() function returns when the user selects Fixedsys:

proc Main()
string font_name [MAXSTRINGLEN] = ''
integer font_size = 0
integer font_flags = 0
ChooseFont(font_name, font_size, font_flags)
Warn(font_name; font_size; font_flags)
PurgeMacro(CurrMacroFilename())
end Main

It might be interesting to see if setting "Fixedsys" works without a size preference:

proc Main()
string font_name [MAXSTRINGLEN] = 'Fixedsys'
integer font_size = 0
integer font_flags = 0
SetFont(font_name, font_size, font_flags)
GetFont(font_name, font_size, font_flags)
Warn(font_name; font_size; font_flags)
PurgeMacro(CurrMacroFilename())
end Main

Less likely, because I assume TSE otherwise works for the user, but maybe a computer with a Chinese locale in this case has a problem with Windows ANSI APIs.
In your test macro you could try replacing the ...A APIs with their ...W counterparts.
In that case the string parameters require and return UTF-16LE instead of ANSI.

Carlo



Carlo Hogeveen

unread,
Jun 24, 2022, 6:14:53 AM6/24/22
to sem...@googlegroups.com

As I have learned in the past days, font-related problems and features are worth testing with TSE's two 3D display configuration options both turned ON and both turned OFF.

These two settings ("Use 3D Characters" and "Use 3D Buttons") need a restart of TSE after they have been changed and TSE's Settings are saved.

Carlo


-----Oorspronkelijk bericht-----
Van: sem...@googlegroups.com <sem...@googlegroups.com> Namens S.E. Mitchell
Verzonden: woensdag 15 juni 2022 04:26
Aan: TSEPro Support <sem...@googlegroups.com>
Onderwerp: [TSE] Help needed - font problem

A user in China is having a font issue.

He can set the Fixedsys font by using the SetFont menu.

However, if he uses SetFont("Fixedsys", 9, 0) (and many
variations), the font is set to Arial or Courier New, but
not to Fixedsys.

I'm trying to figure out why he can't set Fixedsys with
SetFont("Fixedsys", ...).

[ ... deleted ... ]



S.E. Mitchell

unread,
Jun 24, 2022, 6:29:09 AM6/24/22
to TSEPro Support
Yep, font stuff is messy.
I have actually been able to fix the user's problem.
A code change I made over 10 years ago was causing his problem :(
It'll be available in v4.44.

What I found was that it is _very_ important to set logfont.lfCharSet
to DEFAULT_CHARSET.
In many cases, I was setting it to ANSI_CHARSET, which was causing his problem.
That might help some of your stuff too? I don't know, fonts and me
don't get along :)
--
Sammy Mitchell
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/semware/000101d887b3%243da1f6b0%24b8e5e410%24%40ecarlo.nl.
Reply all
Reply to author
Forward
0 new messages