FBTrueType static Win/Lin 32/64-bit

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

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

Postby D.J.Peters » Sep 29, 2016 10:15

@Roland you can try different UTF and unicode examples fom FreeBASIC\examples\unicode folder.
I viewed litle and big endian files with an hex editor.

LE begins with FF FE 27 00 27 00 ...
BE begins with FE FF 00 27 00 27 ...

If FreeBASIC loads and parse the files it' "knows" what are LE and what are BE.

By the way I never tryed notepad it's windows only I use geany instead on Windows, Linux and on my tiny cute ARM devices.
For large C/C++ projects I use code::blocks on all plattforms.

Joshy
St_W
Posts: 1466
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

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

Postby St_W » Sep 29, 2016 11:21

As D.J.Peters has already shown the decoder (e.g. the FreeBasic compiler reading the file) has to know the encoding of a text file.
One method for detecting the encoding is to look for a so called "Byte Order Mark" (BOM); see https://de.wikipedia.org/wiki/Byte_Order_Mark
However, in practice most files don't have a BOM, so the text file readers try to guess the encoding based on the text contents. Of course guessing may sometimes result in a wrong guess, which often leads to Mojibake; see https://en.wikipedia.org/wiki/Mojibake

In general try to use UTF-8 wherever possible. Unfortunately FreeBasic's Unicode support is very limited.
Roland Chastain
Posts: 851
Joined: Nov 24, 2011 19:49
Location: Dakar, Senegal
Contact:

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

Postby Roland Chastain » Sep 29, 2016 17:45

@D.J.Peters, St_W

Thank you for your explanations.
MrSwiss
Posts: 3080
Joined: Jun 02, 2013 9:27
Location: Switzerland

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

Postby MrSwiss » Sep 30, 2016 14:17

@Joshy,

tested:
    FBC 1.05.0 32bit --> OK (WIN/GAS)
    FBC 1.05.0 64bit --> NOK (WIN/GCC)
FBC produces a 'hanger' when compiling with 64bit FBC. (all 4 examples)

Additional: in the FBTrueType.bi --> ByVal missing in the first Function (only 1 parameter "As Long"), Line 15.
D.J.Peters
Posts: 7667
Joined: May 28, 2005 3:28

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

Postby D.J.Peters » Sep 30, 2016 16:15

deleted double post :-)
Last edited by D.J.Peters on Sep 30, 2016 20:58, edited 1 time in total.
D.J.Peters
Posts: 7667
Joined: May 28, 2005 3:28

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

Postby D.J.Peters » Sep 30, 2016 16:19

MrSwiss wrote:FBC produces a 'hanger' when compiling with 64bit FBC. (all 4 examples)
You can make a FreeBASIC bug report for dkl !
I don't think it has something to do with FBTrueType self it's simple C code.

What is your FreeBASIC 64-bit version can you post the output of:
fbc --version ?

and the output of:
fbc -v test01.bas

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

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

Postby D.J.Peters » Sep 30, 2016 16:37

Same on Linux fbc Version 1.05.0 64-bit !

Joshy
fbc 64-bit wrote:joshy@UBUNTUx86-64:~$ cd /media/joshy/32_GB/laufwerkD/CodeBlocks/joshy/FBTrueType
joshy@UBUNTUx86-64:/media/joshy/32_GB/laufwerkD/CodeBlocks/joshy/FBTrueType$ fbc --version
FreeBASIC Compiler - Version 1.05.0 (01-31-2016), built for linux-x86_64 (64bit)
Copyright (C) 2004-2016 The FreeBASIC development team.
joshy@UBUNTUx86-64:/media/joshy/32_GB/laufwerkD/CodeBlocks/joshy/FBTrueType$ fbc -v test01.bas
FreeBASIC Compiler - Version 1.05.0 (01-31-2016), built for linux-x86_64 (64bit)
Copyright (C) 2004-2016 The FreeBASIC development team.
target: linux-x86_64, x86-64, 64bit
compiling: test01.bas -o test01.c (main module)

Aborting due to runtime error 12 ("segmentation violation" signal)
dodicat
Posts: 5758
Joined: Jan 10, 2006 20:30
Location: Scotland

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

Postby dodicat » Sep 30, 2016 18:43

in fbtruetype.bi, if I nullify the function
as follows:
function ErrorText(errcode as long) as string
return "zero"
'select case as const errcode
'case FONT_NOT_LOADED : return "font not loaded"
'case FONT_NOT_SUPPORTED : return "font not supported"
' case NO_FREE_FONTID : return "no free font id (64 fonts in use)"
'case WRONG_FONTID : return "font id is illegal"
' case WRONG_VALUE : return "wrong value (parameter out of range)"
'case GLYPH_NOT_FOUND : return "no glyph for unicode in font"
'case else : return "no error"
'end select
end function

It works with 64 bit gcc.
Something wrong within the select case, so it should fix easily.

Had another look, the offender is:
case FONT_NOT_LOADED
in the function.
Maybe a clash with names, or the number.
It is a compile time error, not an error calling the function.
fxm
Posts: 8969
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

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

Postby fxm » Sep 30, 2016 19:28

It seems that fbc-64bit does not support 'Select Case As Const ...' with a negative value in the 'Case' expression.
With my PC, compiler hangs (it is mandatory to kill fbc.exe):

Code: Select all

dim as long test
select case as const test
case -1
end select
Last edited by fxm on Sep 30, 2016 19:48, edited 5 times in total.
srvaldez
Posts: 1943
Joined: Sep 25, 2005 21:54

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

Postby srvaldez » Sep 30, 2016 19:28

good catch dodicat, but the only thing you need to change is "select case as const errcode" to "select case errcode"
but I would never have found it without you pointing to the source of the problem
after that change the test programs compile ok but only test04 gives the expected output
dodicat
Posts: 5758
Joined: Jan 10, 2006 20:30
Location: Scotland

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

Postby dodicat » Sep 30, 2016 19:49

In the new test03, a warning is given:
This might be causing the problem (only a couple of lines of font showing)

Compiler output:
C:\Users\User\Downloads\FBTrueType (1)\FBTrueType\FBIDETEMP.bas(38) warning 38(0): Mixing operand data types may have undefined results

System:
FBIde: 0.4.6
fbc: FreeBASIC Compiler - Version 1.05.0 (01-31-2016), built for win64 (64bit)
OS: Windows NT 6.2 (build 9200)
dodicat
Posts: 5758
Joined: Jan 10, 2006 20:30
Location: Scotland

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

Postby dodicat » Sep 30, 2016 20:18

Fxm, I cannot reply directly to your above post, I get an illegal situation.
I cannot even reply directly to my own post..
That's Win 10 again I presume!

Anyway, -1 in select case as const (64 bit) seems to kick an almighty (singularity), I had to kill fb.exe (as you did)
But -2, -3 ,-4 ... seem OK.
-1000000 is also OK, I didn't test many in between.
fxm
Posts: 8969
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

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

Postby fxm » Sep 30, 2016 20:27

Yes, you are right.
Only the '-1' value seems to induce a compiler crashing.
D.J.Peters
Posts: 7667
Joined: May 28, 2005 3:28

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

Postby D.J.Peters » Sep 30, 2016 20:55

Thank you all for testing and solving the problem.

I upload the fixed version and tested before with:
Windows 32-bit XP SP3
Windows 10 64-bit (with latest update it was ~ 3GB !)
Slackware 14.1 32-bit
Slackware 14.1 64-bit
Ubuntu 16.04.1 32-bit (with last update yesterday)
Ubuntu 16.04.1 64-bit (with last update yesterday)

Joshy
srvaldez
Posts: 1943
Joined: Sep 25, 2005 21:54

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

Postby srvaldez » Sep 30, 2016 21:11

only test04 and test05 give the expected output
test01 just prints some font numbers on the console, no graphics
test02 shows graphics with various rectangles
test03 shows graphics with with different fonts and colors but the fonts are cramped, no space in between.
test04 ok
test05 ok? ,like test04 but in Greek and Russian

tested on Windows 10 x64

Return to “Libraries”

Who is online

Users browsing this forum: Google [Bot] and 2 guests