FBTrueType static Win/Lin 32/64-bit
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: FBTrueType Windows and Linux (32/64-bit)
@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
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
Re: FBTrueType Windows and Linux (32/64-bit)
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.
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.
-
- Posts: 1007
- Joined: Nov 24, 2011 19:49
- Location: France
- Contact:
Re: FBTrueType Windows and Linux (32/64-bit)
@D.J.Peters, St_W
Thank you for your explanations.
Thank you for your explanations.
Re: FBTrueType Windows and Linux (32/64-bit)
@Joshy,
tested:
Additional: in the FBTrueType.bi --> ByVal missing in the first Function (only 1 parameter "As Long"), Line 15.
tested:
- FBC 1.05.0 32bit --> OK (WIN/GAS)
FBC 1.05.0 64bit --> NOK (WIN/GCC)
Additional: in the FBTrueType.bi --> ByVal missing in the first Function (only 1 parameter "As Long"), Line 15.
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: FBTrueType Windows and Linux (32/64-bit)
deleted double post :-)
Last edited by D.J.Peters on Sep 30, 2016 20:58, edited 1 time in total.
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: FBTrueType Windows and Linux (32/64-bit)
You can make a FreeBASIC bug report for dkl !MrSwiss wrote:FBC produces a 'hanger' when compiling with 64bit FBC. (all 4 examples)
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
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: FBTrueType Windows and Linux (32/64-bit)
Same on Linux fbc Version 1.05.0 64-bit !
Joshy
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)
Re: FBTrueType Windows and Linux (32/64-bit)
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.
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.
Re: FBTrueType Windows and Linux (32/64-bit)
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):
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.
Re: FBTrueType Windows and Linux (32/64-bit)
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
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
Re: FBTrueType Windows and Linux (32/64-bit)
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)
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)
Re: FBTrueType Windows and Linux (32/64-bit)
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.
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.
Re: FBTrueType Windows and Linux (32/64-bit)
Yes, you are right.
Only the '-1' value seems to induce a compiler crashing.
Only the '-1' value seems to induce a compiler crashing.
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: FBTrueType Windows and Linux (32/64-bit)
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
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
Re: FBTrueType Windows and Linux (32/64-bit)
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
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