News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

TextView

Started by Biterider, May 07, 2020, 06:34:09 PM

Previous topic - Next topic

Biterider

Hi
Well, I have to clarify a misunderstanding.  :cool:
RichEdit is basically an edit control that is able to interact with the user and display rich-content.
TextView, on the other hand, was developed to display rich-content in a simple way using markups and handle the resource management automatically. It is not designed as an input control. The lack of this functionality has the great advantage that it is very light and fast. When text entry is required, a classic edit control can do the job.

Biterider

Biterider

Hi
This is a TextView implementation of simple zoomable controls.

The technique used is a combination of active areas and text callbacks. The latter was implemented in the most recent incarnation of this component.
When a mouse or touch interaction is detected in an active area, the implementation of the control responds by setting the appropriate text using the text callback. In the case of the radio button or check box, Unicode characters of the same width have been used to leave the rest of the text unchanged. This way, no recalculation is required, which saves processing time. The only requirement is that the fonts used are installed on the host system. I used "Lucida Sans Unicode" and "Wingdings" which should be included with every Windows installation.

This is a solution for situations where simple interaction is required in a text-based context.
The bonus point is that since it's text based, it's also zoomable, as seen in the attached demo.

Have fun!

Biterider

LiaoMi

Quote from: Biterider on March 13, 2021, 06:05:26 PM
Hi
This is a TextView implementation of simple zoomable controls.

The technique used is a combination of active areas and text callbacks. The latter was implemented in the most recent incarnation of this component.
When a mouse or touch interaction is detected in an active area, the implementation of the control responds by setting the appropriate text using the text callback. In the case of the radio button or check box, Unicode characters of the same width have been used to leave the rest of the text unchanged. This way, no recalculation is required, which saves processing time. The only requirement is that the fonts used are installed on the host system. I used "Lucida Sans Unicode" and "Wingdings" which should be included with every Windows installation.

This is a solution for situations where simple interaction is required in a text-based context.
The bonus point is that since it's text based, it's also zoomable, as seen in the attached demo.

Have fun!

Biterider

Hi Biterider,

I have some elements displayed incorrectly :rolleyes:


Biterider

Hi LiaoMi
Thanks for your feedback. I have a guess as to what is happening here. The selected characters for the checkboxes are 00A3 and 0052 of "Wingdings 2" font. The former (unchecked checkbox) is used to calculate character width. I see on the "Option 4" line a character that is used when the rendering fails. This smaller character reduces the space for the checked checkbox and that is what we see.

Can you check that you have this font installed and what these characters look like when using for instance the option "insert symbols" of MS-Word?
To find out what happens, I can prepare a binary to display the renderable characters of that font.

Thank you for your support.

Biterider

LiaoMi

Quote from: Biterider on March 19, 2021, 08:42:50 AM
Hi LiaoMi
Thanks for your feedback. I have a guess as to what is happening here. The selected characters for the checkboxes are 00A3 and 0052 of "Wingdings 2" font. The former (unchecked checkbox) is used to calculate character width. I see on the "Option 4" line a character that is used when the rendering fails. This smaller character reduces the space for the checked checkbox and that is what we see.

Can you check that you have this font installed and what these characters look like when using for instance the option "insert symbols" of MS-Word?
To find out what happens, I can prepare a binary to display the renderable characters of that font.

Thank you for your support.

Biterider

The font is installed on the system and looks like

Biterider

Hi LiaoMi
I couldn't find an obvious bug on my side, so I decided to add some debug outputs into the code and redirect them to the console (in case you don't have DebugCenter installed).
I also added all characters of the "Wingdings 2" font to the TextView output and found that not all of them are rendered as they should (compared with MS-Mord) and a square is rendered in place of the expected character.

I am very interested to see how this looks on your system.

Biterider

LiaoMi

Hi Biterider,

Debug view  :arrow_left:

Biterider

Hi LiaoMi
That is a surprising result. The debug output confirms that the characters reaching the DrawText API are correct.
On my system I can render almost all characters from this font, but on your system it is very different. About half of it cannot be rendered. I've searched the internet and found some evidence of character mapping errors on OS level, but I can't understand how it relates to this effect..
Which OS are you using?

Biterider

LiaoMi

@Biterider

QuoteWhich OS are you using?

Windows 10 Enterprise Version 1909 Build 18363.418

A couple more links..
http://www.alanwood.net/demos/wingdings-2.html
https://stackoverflow.com/questions/22092370/windows-form-controls-font-not-changing-for-wingding

Other examples also do not display the font correctly.

LiaoMi


and


But I'm not sure if this is the case here:
Why does some text display with square boxes in some apps on Windows 10?
https://support.microsoft.com/en-us/topic/why-does-some-text-display-with-square-boxes-in-some-apps-on-windows-10-b078a35f-9709-1780-44c0-8c27a58205a2

A fallback font is a font which will be used if your other choices aren't usable
https://github.com/gillesgg/DxFontFallback
https://github.com/gillesgg/DxFontFallback/archive/refs/heads/master.zip


fearless

Another option could be to create a minimal font - basically just a font with the glyphs/symbols for windings etc that is required. Then embed the font into the control as data (hence the minimal size) and then use that font - as the font can be loaded as a resource once it is in memory.

Biterider

Hi
This is an interesting problem.
I started testing some other rendering APIs like TextOut and ExTextOut. They solved this problem with Wingdings 2, but introduced some new issues using fonts that behave fine with DrawText or DrawTextEx. In addition, TextOut requires kerning handling, which DrawText does automatically.

I've read some information and documentation on the internet, but it seems that there is no one-size-fits-all solution. :sad:

@fearless: your solution seems to be the most promising, but what puzzles me is that LiaoMi and I have the same font ("Wingdings 2", version 1.55), the same operating system and the same binary file and the result is very different.

I wonder if applications like MS-Word use their own rendering algorithms. I guess so...

Biterider

fearless

Couple of font making resources that are free (might require signup to website or mailing list but thats it)


       
  • https://www.pentacom.jp/pentacom/bitfontmaker2/
  • https://fontstruct.com/
  • http://designwithfontforge.com/en-US/index.html (download at https://fontforge.org/en-US/downloads/windows/)

LiaoMi

Quote from: Biterider on March 21, 2021, 06:40:56 PM
Hi
This is an interesting problem.
I started testing some other rendering APIs like TextOut and ExTextOut. They solved this problem with Wingdings 2, but introduced some new issues using fonts that behave fine with DrawText or DrawTextEx. In addition, TextOut requires kerning handling, which DrawText does automatically.

I've read some information and documentation on the internet, but it seems that there is no one-size-fits-all solution. :sad:

@fearless: your solution seems to be the most promising, but what puzzles me is that LiaoMi and I have the same font ("Wingdings 2", version 1.55), the same operating system and the same binary file and the result is very different.

I wonder if applications like MS-Word use their own rendering algorithms. I guess so...

Biterider

@Biterider

Apart from comparing systems, the last picture shows that the same text on different controls but in the same menu is displayed in different ways, how is this possible, very unusual, I did not notice this before  :biggrin:

Biterider

Hi
@fearless: thanks for the links. I checked them out. The most promising seems to be "fontforge".

@LiaoMi: I don't have a real explanation right now, but I'm still testing.
On my Win7 installation I get the same result as on Win10. On a raw Win8.1 installation, "Wingdings 2" is not installed by default. After installing it, I get the same result as on the other operating systems.
These are the machines I've access today. Tomorrow I will test on other PCs.

Biterider