FBTrueType static Win/Lin 32/64-bit

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
D.J.Peters
Posts: 7419
Joined: May 28, 2005 3:28

FBTrueType static Win/Lin 32/64-bit

Postby D.J.Peters » Sep 26, 2016 20:22

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: Fri Sep 30, 2016
download: FBTrueType-src.zip

NOTE: Don't open/edit TTPrintWString.bas with FBEdit you need an edtor that can work with Unicode strings like geany or others !

Joshy
Image
Image
Last edited by D.J.Peters on May 06, 2018 13:19, edited 11 times in total.
srvaldez
Posts: 1535
Joined: Sep 25, 2005 21:54

Re: preview: FBTrueType Windows and Linux (32/64-bit)

Postby srvaldez » Sep 26, 2016 20:42

hi Joshy
that looks really good, thanks for sharing :)
D.J.Peters
Posts: 7419
Joined: May 28, 2005 3:28

Re: preview: FBTrueType Windows and Linux (32/64-bit)

Postby D.J.Peters » Sep 26, 2016 20:54

I'm really happy about the quality and speed.

Joshy

Test of height = 800 pixels:
Image
Image
Last edited by D.J.Peters on Sep 25, 2017 15:11, edited 1 time in total.
D.J.Peters
Posts: 7419
Joined: May 28, 2005 3:28

Re: FBTrueType Windows and Linux (32/64-bit)

Postby D.J.Peters » Sep 27, 2016 12:12

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
Image
Last edited by D.J.Peters on May 06, 2018 13:21, edited 8 times in total.
St_W
Posts: 1279
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: FBTrueType Windows and Linux (32/64-bit)

Postby St_W » Sep 27, 2016 12:29

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.
D.J.Peters
Posts: 7419
Joined: May 28, 2005 3:28

Re: FBTrueType Windows and Linux (32/64-bit)

Postby D.J.Peters » Sep 27, 2016 12:36

@St_W thank you.

The link to source code should work now

Joshy
D.J.Peters
Posts: 7419
Joined: May 28, 2005 3:28

Re: FBTrueType Windows and Linux (32/64-bit)

Postby D.J.Peters » Sep 27, 2016 12:47

I fixed a small bug in test04.bas it's in the new zip file.

Joshy
D.J.Peters
Posts: 7419
Joined: May 28, 2005 3:28

Re: FBTrueType Windows and Linux (32/64-bit)

Postby D.J.Peters » Sep 27, 2016 14:31

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
Image
Last edited by D.J.Peters on May 06, 2018 13:23, edited 3 times in total.
St_W
Posts: 1279
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: FBTrueType Windows and Linux (32/64-bit)

Postby St_W » Sep 27, 2016 14:59

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?
D.J.Peters
Posts: 7419
Joined: May 28, 2005 3:28

Re: FBTrueType Windows and Linux (32/64-bit)

Postby D.J.Peters » Sep 27, 2016 15:18

St_W wrote:... because FreeType supports e.g. hinting and many other features ...

To place glyphs on the right position I need only ascend, descend, linegap and kerning
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
D.J.Peters
Posts: 7419
Joined: May 28, 2005 3:28

Re: FBTrueType Windows and Linux (32/64-bit)

Postby D.J.Peters » Sep 27, 2016 15:28

I found "font hinting" never heard before:-)

https://en.wikipedia.org/wiki/Font_hinting
https://www.microsoft.com/typography/TrueTypeHintingWhat.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
Image
Last edited by D.J.Peters on Sep 25, 2017 15:14, edited 1 time in total.
Roland Chastain
Posts: 834
Joined: Nov 24, 2011 19:49
Location: Dakar, Senegal
Contact:

Re: FBTrueType Windows and Linux (32/64-bit)

Postby Roland Chastain » Sep 28, 2016 14:08

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).
Roland Chastain
Posts: 834
Joined: Nov 24, 2011 19:49
Location: Dakar, Senegal
Contact:

Re: FBTrueType Windows and Linux (32/64-bit)

Postby Roland Chastain » Sep 28, 2016 14:25

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.
D.J.Peters
Posts: 7419
Joined: May 28, 2005 3:28

Re: FBTrueType Windows and Linux (32/64-bit)

Postby D.J.Peters » Sep 28, 2016 20:52

@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 ?

Code: Select all

dim as wstring * 20 russian = "Привет, мир!"
dim as wstring * 20 greek   = "Καλημέρα κόσμε!"
Roland Chastain
Posts: 834
Joined: Nov 24, 2011 19:49
Location: Dakar, Senegal
Contact:

Re: FBTrueType Windows and Linux (32/64-bit)

Postby Roland Chastain » Sep 29, 2016 6:31

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?

Return to “Libraries”

Who is online

Users browsing this forum: No registered users and 1 guest