FBTrueType static Win/Lin 32/64-bit
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
FBTrueType static Win/Lin 32/64-bit
preview of FBTrueType ASCII and Unicode (no dependencies too Freetype6 or other dynamic libraries)
This version used the original stb_truetype.h it's public domain and I added FBGFX image functionality.
download: FBTrueType.zip from: Oct 27, 2022
download: FBTrueType-src.zip
NOTE: Don't open/edit TTPrintWString.bas with FBIde you need an editor that can work with Unicode strings like geany or others !
Joshy
This version used the original stb_truetype.h it's public domain and I added FBGFX image functionality.
download: FBTrueType.zip from: Oct 27, 2022
download: FBTrueType-src.zip
NOTE: Don't open/edit TTPrintWString.bas with FBIde you need an editor that can work with Unicode strings like geany or others !
Joshy
Last edited by D.J.Peters on Oct 27, 2022 5:38, edited 16 times in total.
Re: preview: FBTrueType Windows and Linux (32/64-bit)
hi Joshy
that looks really good, thanks for sharing :)
that looks really good, thanks for sharing :)
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: preview: FBTrueType Windows and Linux (32/64-bit)
I'm really happy about the quality and speed.
Joshy
Test of height = 800 pixels:
Joshy
Test of height = 800 pixels:
Last edited by D.J.Peters on Oct 12, 2022 18:12, edited 2 times in total.
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: FBTrueType Windows and Linux (32/64-bit)
I switched to stb_truetype.h the quality are the same but it's faster then my try and I added FBGFX image functionality. (see first post)
I added TTPrint()
Joshy
I added TTPrint()
Joshy
Last edited by D.J.Peters on Oct 12, 2022 18:12, edited 9 times in total.
Re: FBTrueType Windows and Linux (32/64-bit)
With source now, great! (btw the source-package link in the first post points to the wrong file)
Font rendering always has been a major weakness of fbgfx2, so this is a great contribution.
Thank you for sharing!
I'll give it a try on the weekend.
Font rendering always has been a major weakness of fbgfx2, so this is a great contribution.
Thank you for sharing!
I'll give it a try on the weekend.
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: FBTrueType Windows and Linux (32/64-bit)
@St_W thank you.
The link to source code should work now
Joshy
The link to source code should work now
Joshy
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: FBTrueType Windows and Linux (32/64-bit)
I fixed a small bug in test04.bas it's in the new zip file.
Joshy
Joshy
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: FBTrueType Windows and Linux (32/64-bit)
here are TTPrint overloaded with wstring
note: FBIDE doesn't support unicode strings I used geany for "TTPrintWString.bas".
The russian and greek "hello world" wstrings comes from FreeBASIC unicode examples.
Joshy
note: FBIDE doesn't support unicode strings I used geany for "TTPrintWString.bas".
The russian and greek "hello world" wstrings comes from FreeBASIC unicode examples.
Joshy
Last edited by D.J.Peters on Oct 12, 2022 18:12, edited 4 times in total.
Re: FBTrueType Windows and Linux (32/64-bit)
I took a quick look into the stb_truetype.h you're using and saw that e.g. hinting is still on the TODO list, which may be a problem when using small font sizes and/or small (display) resolutions.
As an external library ist still required (linked statically, only at compile time) I asked myself what are the pros/cons of using e.g. FreeType as a "backend" for your library instead of stb_truetype.h (because FreeType supports e.g. hinting and many other features). Maybe you could give a short explanation? Is this even possible?
As an external library ist still required (linked statically, only at compile time) I asked myself what are the pros/cons of using e.g. FreeType as a "backend" for your library instead of stb_truetype.h (because FreeType supports e.g. hinting and many other features). Maybe you could give a short explanation? Is this even possible?
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: FBTrueType Windows and Linux (32/64-bit)
To place glyphs on the right position I need only ascend, descend, linegap and kerningSt_W wrote:... because FreeType supports e.g. hinting and many other features ...
italic and bold comes from the font self what is "hinting" and which other feature do you need ?
If you remove all unsed parts (the backed OpenGL quad rendering stuff, and codepoint calls) from stb_truetype.h it's only 6 KB that grows up the *.exe.
Joshy
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: FBTrueType Windows and Linux (32/64-bit)
I found "font hinting" never heard before:-)
https://en.wikipedia.org/wiki/Font_hinting
https://www.microsoft.com/typography/Tr ... gWhat.mspx
May be you need it for high quality desktop publishing or word processor but for other apps or GUI's I personaly don't need it.
joshy
https://en.wikipedia.org/wiki/Font_hinting
https://www.microsoft.com/typography/Tr ... gWhat.mspx
May be you need it for high quality desktop publishing or word processor but for other apps or GUI's I personaly don't need it.
joshy
Last edited by D.J.Peters on Oct 12, 2022 18:12, edited 2 times in total.
-
- Posts: 1007
- Joined: Nov 24, 2011 19:49
- Location: France
- Contact:
Re: FBTrueType Windows and Linux (32/64-bit)
Great! Thank you for that library.
There is a typo in the name of the FontProperties() function (and also, by the way, in the name of the file pocketcalculator.ttf).
There is a typo in the name of the FontProperties() function (and also, by the way, in the name of the file pocketcalculator.ttf).
-
- Posts: 1007
- Joined: Nov 24, 2011 19:49
- Location: France
- Contact:
Re: FBTrueType Windows and Linux (32/64-bit)
I have a problem with test05.bas. It's under Windows 10. I saved the code in Notepad++ with default encoding (UTF-8 without BOM).
Last edited by Roland Chastain on Oct 06, 2016 7:49, edited 1 time in total.
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: FBTrueType Windows and Linux (32/64-bit)
@Roland the FreeBASIC wstring is unicode 2 bytes per char on windows 4 bytes on linux not UTF8 (so far I know) may be i'm wrong
I'm a german and never used wstring before ASCII codes only :-)
Joshy
How this two lines looks in notepad ?
I'm a german and never used wstring before ASCII codes only :-)
Joshy
How this two lines looks in notepad ?
Code: Select all
dim as wstring * 20 russian = "Привет, мир!"
dim as wstring * 20 greek = "Καλημέρα κόσμε!"
-
- Posts: 1007
- Joined: Nov 24, 2011 19:49
- Location: France
- Contact:
Re: FBTrueType Windows and Linux (32/64-bit)
The two lines look correct in Notepad++ (I can see the russian and greek characters).
After I read your message, I tried to convert my file (using Notepad++) to UTF-16BE, and now the the program display correctly the characters. I also tried UTF-16LE, and it works too. Why is there no difference between UTF-16BE and UTF16-LE?
After I read your message, I tried to convert my file (using Notepad++) to UTF-16BE, and now the the program display correctly the characters. I also tried UTF-16LE, and it works too. Why is there no difference between UTF-16BE and UTF16-LE?