Post by DJLinux on Nov 30, 2009 3:14:46 GMT -5
Now you can use all Windows Fonts in any size. ;D
For details about all params see at:
msdn.microsoft.com/en-us/library/dd183499(VS.85).aspx
It's a preview please report any problems.
Joshy
Download: FontPlugin.zip
Get number of all fonts
Fonts% =GetFontCount()
Get a font name by index% can be uses with NewFont(Name$).
FontName$ = GetFontName(index%)
create a font by name with default params
FontID%=NewFont(Name$)
use a font by ID
UseFont(FontID%,GlLists%)
set font position in window coords (pixel)
glFontPos2i(x%,y%)
delete a font (free all resources)
DeleteFont(FontID%)
you can set all font params manualy "before" you create it
bool% = TRUE or FALSE
SetFontItalic(bool%)
SetFontUnderline(bool%)
SetFontStrikeout(bool%)
SetFontHeight(height%)
SetFontWidth(width%)
SetFontEscapement(Escapement%)
SetFontOrientation(Orientation%)
WEIGHT_ consts are:
weight_dontcare weight_bold weight_extrabold weight_extralight weight_heavy weight_light weight_medium weight_normal weight_semibold weight_thin
SetFontWeight(WEIGHT_...)
CHARSET_ consts are:
charset_default charset_ansi charset_arabic charset_baltic charset_chinesebig5 charset_easteurope charset_gb2312 charset_greek charset_hangeul charset_hebrew charset_johab charset_mac charset_oem charset_russian charset_shiftjis charset_symbol charset_thai charset_turkish
SetFontCharSet(CHARSET_...)
OUT_PRECISION consts are:
out_default out_device out_outline out_raster out_string out_stroke out_tt out_tt_only
SetFontOutPrecision(OUT_...)
CLIP_PRECISION consts are:
clip_default clip_embedded clip_lh_angles clip_stroke
SetFontClipPrecision(CLIP_...)
QUALITY_ consts are:
quality_default quality_antialiased quality_draft quality_nonantialiased quality_proof
SetFontQuality(QUALITY_...)
PITCH_ and FAMILY_ consts are:
pitch_default pitch_fixed pitch_variable family_dontcare family_decorative family_modern family_roman family_script family_swiss
SetFontPitchAndFamily(PITCH_ OR FAMILY_)
Create a font with all it's params
FontID=CreateFont(Height%,Width%,Escapement%,Orientation%,Weight%, Italic%, Underline%, Strikeout%, CharSet%,OutPrecision%, ClipPrecision%, Quality%, PitchAndFamily%, Name$)

For details about all params see at:
msdn.microsoft.com/en-us/library/dd183499(VS.85).aspx
It's a preview please report any problems.
Joshy
Download: FontPlugin.zip
Get number of all fonts
Fonts% =GetFontCount()
Get a font name by index% can be uses with NewFont(Name$).
FontName$ = GetFontName(index%)
create a font by name with default params
FontID%=NewFont(Name$)
use a font by ID
UseFont(FontID%,GlLists%)
set font position in window coords (pixel)
glFontPos2i(x%,y%)
delete a font (free all resources)
DeleteFont(FontID%)
you can set all font params manualy "before" you create it
bool% = TRUE or FALSE
SetFontItalic(bool%)
SetFontUnderline(bool%)
SetFontStrikeout(bool%)
SetFontHeight(height%)
SetFontWidth(width%)
SetFontEscapement(Escapement%)
SetFontOrientation(Orientation%)
WEIGHT_ consts are:
weight_dontcare weight_bold weight_extrabold weight_extralight weight_heavy weight_light weight_medium weight_normal weight_semibold weight_thin
SetFontWeight(WEIGHT_...)
CHARSET_ consts are:
charset_default charset_ansi charset_arabic charset_baltic charset_chinesebig5 charset_easteurope charset_gb2312 charset_greek charset_hangeul charset_hebrew charset_johab charset_mac charset_oem charset_russian charset_shiftjis charset_symbol charset_thai charset_turkish
SetFontCharSet(CHARSET_...)
OUT_PRECISION consts are:
out_default out_device out_outline out_raster out_string out_stroke out_tt out_tt_only
SetFontOutPrecision(OUT_...)
CLIP_PRECISION consts are:
clip_default clip_embedded clip_lh_angles clip_stroke
SetFontClipPrecision(CLIP_...)
QUALITY_ consts are:
quality_default quality_antialiased quality_draft quality_nonantialiased quality_proof
SetFontQuality(QUALITY_...)
PITCH_ and FAMILY_ consts are:
pitch_default pitch_fixed pitch_variable family_dontcare family_decorative family_modern family_roman family_script family_swiss
SetFontPitchAndFamily(PITCH_ OR FAMILY_)
Create a font with all it's params

FontID=CreateFont(Height%,Width%,Escapement%,Orientation%,Weight%, Italic%, Underline%, Strikeout%, CharSet%,OutPrecision%, ClipPrecision%, Quality%, PitchAndFamily%, Name$)

' this vars must be global
dim ListBase
dim FontColor(2)
'
sub FontPrint(x,y,txt$)
dim n=len(txt$)
if n<1 then return :endif
dim chars(255),i
for i=0 to n-1
chars(i)=asc(mid$(txt$,i+1,1))
next
'
glColor3ubv(FontColor)
glFontPos2i(x,y)
glPushAttrib(GL_LIST_BIT)
glListBase(ListBase)
glCallLists(n, GL_UNSIGNED_BYTE,chars)
glPopAttrib()
end sub
'
const FONTHEIGHT = 28
'
dim Font1
SetFontHeight(FONTHEIGHT)
SetFontCharSet(CHARSET_OEM)
SetFontPitchAndFamily(FAMILY_SCRIPT)
SetFontWeight(600)
Font1 = NewFont("Script")
if Font1=0 then
printr "error: NewFont() !"
beep():input$():end
end if
'
' create range of glLists
ListBase = glGenLists(256)
UseFont(Font1,ListBase)
FontColor(0)=128
FontColor(1)=128
'
dim t$,i=1
read T$
while (t$<>"-end-")
FontPrint(30,WindowHeight()-i*FONTHEIGHT,T$)
i=i+1
read t$
wend
SwapBuffers()
'
' free all resources
DeleteFont(Font1)
glDeleteLists(ListBase,256)
'
data "Long time ago in a galaxy far,"
data "far away...."
data ""
data "It is a period of civil war."
data "Rebel spaceships, striking from a hidden base,"
data "have won their first victory"
data "against the evil Galactic Empire."
data ""
data "During the battle,"
data "Rebel spies managed to stealsecret plans"
data "to the Empire's ultimate weapon,"
data "the Death Star, an armoured space station"
data "with enough power to destroy an entire planet."
data "Pursued by the Empire's sinister agents,"
data "Princess Leia races home aboard her starship,"
data "custodian of the stolen plans that can save"
data "her people and restore freedom to the galaxy..."
data "-end-"