FBTrueType static Win/Lin 32/64-bit
Re: FBTrueType static Win/Lin 32/64-bit
Compile with a FB version >= 1.04.0 (1.05.0 for example).
-
- Posts: 4
- Joined: May 04, 2018 18:42
Re: FBTrueType static Win/Lin 32/64-bit
The best solutions are the simple ones.
An update solved the problem.
The font looks great in my programs.
Thanks for the tip!
steve
An update solved the problem.
The font looks great in my programs.
Thanks for the tip!
steve
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: FBTrueType static Win/Lin 32/64-bit
Hello Mr. Werner Karl Heisenberg :-)
"DrawStringCreateBitmap.bas" is only to create a bitmap font from TrueType font.
I added "DrawStringTestBitmap.bas" also.
Joshy
"DrawStringCreateBitmap.bas" is only to create a bitmap font from TrueType font.
I added "DrawStringTestBitmap.bas" also.
Joshy
Last edited by D.J.Peters on May 06, 2018 13:29, edited 1 time in total.
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: FBTrueType static Win/Lin 32/64-bit
I added LoadFontBitmap(), getFontInfo(), getFontHeight() and getTextWidth() see file "FBTrueType.bi"
and found out something goes wrong the lowercase letter "g" has some wrong pixels ?
Is it "test06.bas" that create the bitmap or Draw String it's self ?
May be the wrong pixels comes from "f" letter in front of the"g" letter
inside the font bitmap I must do a deeper look on it.
Joshy
and found out something goes wrong the lowercase letter "g" has some wrong pixels ?
Is it "test06.bas" that create the bitmap or Draw String it's self ?
May be the wrong pixels comes from "f" letter in front of the"g" letter
inside the font bitmap I must do a deeper look on it.
Joshy
Last edited by D.J.Peters on Oct 12, 2022 18:13, edited 2 times in total.
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: FBTrueType static Win/Lin 32/64-bit
I put LoadFontBitmap(), getFontInfo(), getFontHeight() and getTextWidth() in file: FBTrueType.bi
as a bad workaround I added one dummy pixel to the char width table.
Joshy
as a bad workaround I added one dummy pixel to the char width table.
Joshy
Last edited by D.J.Peters on May 06, 2018 13:29, edited 1 time in total.
Re: FBTrueType static Win/Lin 32/64-bit
Hmm. Mr. Heisenberg's post have timestamp, but not location. Hmm :-)
(*) https://en.wikipedia.org/wiki/Uncertainty_principle
(*) https://en.wikipedia.org/wiki/Uncertainty_principle
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: FBTrueType static Win/Lin 32/64-bit
I found and fixed the problem :-)
Delete your old FBTrueType folder and download and extract the zip file again.
I gave the tests more meaningful names
GlyphIndex.bas
ShowBoundingBox.bas
LowLevel.bas
TTPrintString.bas
TTPrintWString.bas
DrawStringCreateBitmap.bas
DrawStringTestBitmap.bas
Joshy
Last edited by D.J.Peters on Oct 12, 2022 18:13, edited 1 time in total.
-
- Posts: 4
- Joined: May 04, 2018 18:42
Re: FBTrueType static Win/Lin 32/64-bit
Wow! Thanks, Joshy!
As always: Great work and support.
As a real rookie to FB, i really appreciate that.
(I learned to code with Turbo Pascal, ages ago)
Gonna update files and check it as soon as i find time.
Damn real life :)
@marcov: Lol!
But in fact, i'm more a fan of LaPlace and his determinism theory.
https://en.wikipedia.org/wiki/Laplace%27s_demon
steve
As always: Great work and support.
As a real rookie to FB, i really appreciate that.
(I learned to code with Turbo Pascal, ages ago)
Gonna update files and check it as soon as i find time.
Damn real life :)
@marcov: Lol!
But in fact, i'm more a fan of LaPlace and his determinism theory.
https://en.wikipedia.org/wiki/Laplace%27s_demon
steve
-
- Posts: 4
- Joined: May 04, 2018 18:42
Re: FBTrueType static Win/Lin 32/64-bit
@joshy:
Something off-topic:
I'm a musician/guitarist, and the reason i start to try working with FB is to
write some kind of "composing tools" (for easier re-harmonizing, for example).
Since you seem to be a musician too: Did you ever work on something like this?
I mean something music related?
Just curious.
steve
Something off-topic:
I'm a musician/guitarist, and the reason i start to try working with FB is to
write some kind of "composing tools" (for easier re-harmonizing, for example).
Since you seem to be a musician too: Did you ever work on something like this?
I mean something music related?
Just curious.
steve
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: FBTrueType static Win/Lin 32/64-bit
@Steve I wrote Paganini a MIDI sequencer with some audio tracks 20 years ago, yes I'm old ;-)
Currently I try to fix a bug in FBSound V1.0 section DSP effects fbs_PitchShifter()
my optimized 32-bit assembler version is OK but the devil are in 64-bit mode.
Looks like I have to rewrite a none optimized version
and make it faster and faster step by step in 64-bit mode.
With other words after all the years I self don't understand
my optimized version any more and lost the original code of the slow version :-)
In your case for a composing tool I self would use FLTK-c as a fast GUI and FBSound for audio playback.
Joshy
Currently I try to fix a bug in FBSound V1.0 section DSP effects fbs_PitchShifter()
my optimized 32-bit assembler version is OK but the devil are in 64-bit mode.
Looks like I have to rewrite a none optimized version
and make it faster and faster step by step in 64-bit mode.
With other words after all the years I self don't understand
my optimized version any more and lost the original code of the slow version :-)
In your case for a composing tool I self would use FLTK-c as a fast GUI and FBSound for audio playback.
Joshy
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: FBTrueType static Win/Lin 32/64-bit
Hello paul good find width height in LoadFontBitmap was wrong
must be long not integer (32 vs 64-bit)
Joshy
must be long not integer (32 vs 64-bit)
Joshy
Code: Select all
function LoadFontBitmap(byref fontbmpfile as string) as any ptr
dim as long w,h ' <-- changed from integer 32/64bit to 32bit long
...
...
Re: FBTrueType static Win/Lin 32/64-bit
Thanks Joshy for this contribution.
I want to experiment with this a bit. How can i re-use the available ttf files i have on my laptop?
Say for example the ttf files that comes with win10.
My goal is to avoid having to include ttf files along with my source code files.
I suppose the solution is that my program would do a directory search for ttf files in commonly known win folders.
I'm guessing that these directories are not the same for all versions of windows.
Or if the user of my programs are running linux then that would be even more locations to search.
I guess my question is: how do you do it? Ie. in FbEdit if you want to change the code font it opens a font selection dialog.
How does fbedit know the fonts i have available?
I want to experiment with this a bit. How can i re-use the available ttf files i have on my laptop?
Say for example the ttf files that comes with win10.
My goal is to avoid having to include ttf files along with my source code files.
I suppose the solution is that my program would do a directory search for ttf files in commonly known win folders.
I'm guessing that these directories are not the same for all versions of windows.
Or if the user of my programs are running linux then that would be even more locations to search.
I guess my question is: how do you do it? Ie. in FbEdit if you want to change the code font it opens a font selection dialog.
How does fbedit know the fonts i have available?
Re: FBTrueType static Win/Lin 32/64-bit
i get some errors saying error: loading: whatever.ttf no free font id
also is there a way to not have to copy the ttf files to the directory?
also is there a way to not have to copy the ttf files to the directory?
Code: Select all
#include once "FBTrueType.bi"
screenres 800,80,32
Dim As String fontfile,fontfiles(),fontfiletemp,errors
Dim As Integer font_c,errors_c
fontfiletemp=Dir("c:\windows\fonts\*.ttf")
Do
If fontfiletemp="" Then
Exit Do
Else
font_c+=1
ReDim Preserve fontfiles(font_c)
fontfiles(font_c)=fontfiletemp
fontfiletemp=Dir()
EndIf
Loop
If font_c>0 Then
Shell "copy c:\windows\fonts\*.ttf"
Dim As Long font
For i As Integer = 1 To font_c
font = FontLoad(fontfiles(i))
If font<0 Then
errors_c+=1
errors += "error: loading: " & fontfiles(i) & " " & ErrorText(font) & Chr(10) & Chr(13)
Else
TTPrint font,10,10, fontfiles(i) ,rgb(255,255,255),33
Sleep 100
Cls
End if
Next
If errors_c>0 Then
Print errors_c;" errors"
Print "error data saved in errors.txt"
Open "errors.txt" For Output As #1
Print #1, errors
Close #1
Else
Print "no errors"
EndIf
Else
Print "no fonts found in c:\windows\fonts"
End If
Sleep
Re: FBTrueType static Win/Lin 32/64-bit
there must be a max of 64 fonts
Code: Select all
#include once "FBTrueType.bi"
screenres 800,100,32
Dim As String fontfile,fontfiles(),fontfiletemp,errors
Dim As Integer font_c,errors_c
fontfiletemp=Dir("c:\windows\fonts\*.ttf")
Do
If fontfiletemp="" Then
Exit Do
Else
font_c+=1
ReDim Preserve fontfiles(font_c)
fontfiles(font_c)=fontfiletemp
fontfiletemp=Dir()
EndIf
Loop
Dim As Long font(font_c)
If font_c>0 Then
Shell "copy c:\windows\fonts\*.ttf"
For i As Integer = 1 To font_c
font(i) = FontLoad(fontfiles(i))
If font(i)<0 Then
errors_c+=1
errors += "error: loading: " & fontfiles(i) & " " & ErrorText(font(i)) & Chr(10) & Chr(13)
End if
Next
If errors_c>0 Then
Print errors_c;" errors"
Print "error data saved in errors.txt"
Open "errors.txt" For Output As #1
Print #1, errors
Close #1
Else
Print "no errors"
EndIf
Else
Print "no fonts found in c:\windows\fonts"
End If
Sleep 1000
Dim As Integer c
For i As Integer = 1 To font_c
If font(i)<>0 Then
Cls
c+=1
Print fontfiles(i)
Print c
TTPrint font(i),10,20, fontfiles(i) ,rgb(255,255,255),33
Sleep 500
EndIf
Next