[Tutorial] How to use non-ASCII characters in VTFT and VGLCD

General discussion on Visual TFT Software.
Author
Message
aCkO
Posts: 1119
Joined: 14 Feb 2011 04:07
Location: Bar, Montenegro

Re: [Tutorial] How to use non-ASCII characters in VTFT and V

#16 Post by aCkO » 13 Aug 2015 00:18

vt23 wrote:Maybe other issue is: I have to replace all the fonts and text functions by BitPack's text somehow
This can easily be solved by mE developers only if they are willing to consider that option. The only thing they have to do in their TFT library is to declare function pointers instead of functions like TFT_Set_Font, TFT_Write_Text etc. There is no danger of breaking the compatibility since those pointers could be initialized to current functions. That would make the TFT library truly generic and opened to custom font formats and rendering functions.

I already reverse engineered most of mE's MCL/EMCL format in order to manually replace/rename/delete existing or add new library functions, but at the moment I don't have enough time to work on that project. That would solve the above problem without the help of mE developers. Hopefully, when I get some free time I will finish that project and publish the results. That's of course only if it gets approved by mE :)

Regards

vt23
Posts: 44
Joined: 17 Jun 2014 10:36

Re: [Tutorial] How to use non-ASCII characters in VTFT and V

#17 Post by vt23 » 20 Aug 2015 07:42

Hello aCkO,
CP font generator is very useful tool. Nevertheless it can be hard to distinguish more generated fonts to each other. Always I modify the name of the font array in .c file from this: Name_Style_WidthxHeight[] to this: NamePtSize_Style_WidthxHeight_BPformat[] (BPformat is e.g. 3bpp) because I can't certainly recognize how is the Width or Height (probably in pixels) related to Font Size in Points. Can you explain the relation?
Then I would like to know: Does every character his own height or is there a common height given according to the highest character? (When I add "Č" to 32...127 character set then the Height is increased.)
Also when I choose Tahoma font size 20 pt or 28 pt then I click on Export button, you can see in the new window header: "Size: 20,25" or "Size: 27,75" respectively. What is the calculation of that?
Often I choose some additional special characters to generate new font but then I don't know what characters and how many of them are included in the certain font array. Would it be difficult to generate some comment with list of character numbers included in an array?

Code: Select all

// 32...127,176,204,211,231

This can be written above or under the identifiers. There can be written every character number or non-broken sequences can be written like "48...57" or "32...127".

Regards

Vitek

aCkO
Posts: 1119
Joined: 14 Feb 2011 04:07
Location: Bar, Montenegro

Re: [Tutorial] How to use non-ASCII characters in VTFT and V

#18 Post by aCkO » 21 Aug 2015 03:00

vt23 wrote:Then I would like to know: Does every character his own height or is there a common height given according to the highest character?
It has to be common height if we want to render characters correctly. Think of it as a common reference point. The downside of AN1182 format is that it stores empty pixels (top and bottom) when it is actually much more efficient to store vertical offset. That's how I do it in my BitPack format.
vt23 wrote:because I can't certainly recognize how is the Width or Height (probably in pixels) related to Font Size in Points. Can you explain the relation?...
Also when I choose Tahoma font size 20 pt or 28 pt then I click on Export button, you can see in the new window header: "Size: 20,25" or "Size: 27,75" respectively. What is the calculation of that?
A point (pt) is a typographic unit of measurement. It is equivalent to 1/72th of an inch. To convert that to pixels, we have to know DPI setting of the OS. In Windows, this is 96 dpi by default (it can be changed). In your case, for 20pt font this translates to 20/72*96 = 26.66667 pixels which must be rounded to 27px. When you convert back to points: 27/96*72 = 20.25pt which is the real size in points. Similarly, 28pt = 28/72*96 = 37.33px => rounded to 37px = 37/96*72 = 27.75pt.
vt23 wrote:Often I choose some additional special characters to generate new font but then I don't know what characters and how many of them are included in the certain font array. Would it be difficult to generate some comment with list of character numbers included in an array?
Try the file from attachment.

Regards
Attachments
cpFontGenerator.zip
(114.18 KiB) Downloaded 319 times

vt23
Posts: 44
Joined: 17 Jun 2014 10:36

Re: [Tutorial] How to use non-ASCII characters in VTFT and V

#19 Post by vt23 » 21 Aug 2015 07:01

Hello aCkO,

wow, you're really good :D. Thanks. I hope it will help to other guys too.
I read much information about typographic units and then I asked. But I didn't think about Windows' DPI :oops: .
I asked the question about height because some text in the Button (object) from BP fonts is not vertically aligned equally like the default font. It's because of different height of font which can differ according to generated characters above 127 (0x7F). But the shift is usually only 1-2 pixels for big font sizes so I can optionally correct it.

One more thank to you

Vitek

yugaja
Posts: 1
Joined: 09 Feb 2016 13:38

Re: [Tutorial] How to use non-ASCII characters in VTFT and V

#20 Post by yugaja » 09 Feb 2016 14:55

Hello aCko,

I was wondering if there is any chance for mikroC for ARM version of BitPack Font Library package in near future?

and once again thanks for shareing of your valuable works.

pete_b
Posts: 1
Joined: 31 Aug 2016 15:41

Re: [Tutorial] How to use non-ASCII characters in VTFT and V

#21 Post by pete_b » 31 Aug 2016 15:52

Hi aCkO

Thank you for this library. Just wondering if there is any chance you could share the source code or provide more details about the binary format?

I need to support Chinese in an application and need to be able to use unicode and additionally would need to write a new font generator to support this.

Thank you

vt23
Posts: 44
Joined: 17 Jun 2014 10:36

Re: [Tutorial] How to use non-ASCII characters in VTFT and V

#22 Post by vt23 » 31 Jan 2017 10:47

Hello aCkO,

it's a long time since last posts. I hope you are still engaged with these graphic things. I am working on drawing transparent objects (boxes) with opaque text over part of the screen (the screen has an image as the background and small images over this). So the transparent drawing can be done together with reading the display data (as the best way). Do you think so? It is quite slow process - probably the reading is quite slow.
You've done similar things in BitPack library - I mean the mixing of the anti-aliased fonts' edges with background. Can you explain how do you calculate the degree of transparency, please?
E.g.: You have 3-bit antialiasing, that means you have 8 colors (black, 6 greys, white) and then you have to mix background colors to it. (I know, with colored font you have to mix the background also with different R,G,B parts of the font.) Can you show me the calculations with colors and shades of grey?

Best regards
Vitek

KalipSoo
Posts: 7
Joined: 26 Jul 2022 10:43

Re: [Tutorial] How to use non-ASCII characters in VTFT and VGLCD

#23 Post by KalipSoo » 23 Sep 2022 14:05

hello, sorry, perhaps, for a banal problem with the Russian (Ukrainian) language - it does not display characters on the display of riverdi 7 with stm32f4 !
I use font generator -> choose code page (1251) Cyrilic-> range 32-255-> generate -> paste content into resource.c file - don't touch first line with font name? but not work!

P.S. Спасибо за помощь
Проект прилагаю
Attachments
STM32F107VC FT812 test.rar
(399.65 KiB) Downloaded 33 times
0-02-05-534a4f9803629da1a9b582750b2e8047d1a07a78aa8f47611e353ab83880bdfb_7cbe4291dd09b186.jpg
0-02-05-534a4f9803629da1a9b582750b2e8047d1a07a78aa8f47611e353ab83880bdfb_7cbe4291dd09b186.jpg (25.92 KiB) Viewed 1451 times
Снимок.JPG
Снимок.JPG (35.66 KiB) Viewed 1451 times

KalipSoo
Posts: 7
Joined: 26 Jul 2022 10:43

Re: [Tutorial] How to use non-ASCII characters in VTFT and VGLCD

#24 Post by KalipSoo » 24 Sep 2022 09:54

Спасибо всем кто хотел помочь, главная моя ошибка біла - при компиляции файл resources.c перезаписывается. НУЖНО поставить у свойствах файла - ТОЛЬКО ЧТЕНИЕ!
На будущее прилагаю файл resources.c с шрифтом TAHOMA, размером (12,14,16,20,24)!
Attachments
0-02-05-467cb1e1669771c5622ccf44fdd277fcf60a51952ca96dede29ef5f8c4dadc64_873463f168cf39d2.jpg
0-02-05-467cb1e1669771c5622ccf44fdd277fcf60a51952ca96dede29ef5f8c4dadc64_873463f168cf39d2.jpg (44.53 KiB) Viewed 1434 times
FT812_207VG_resources.rar
(31.89 KiB) Downloaded 36 times

Post Reply

Return to “Visual TFT General”