Monospaced Fonts

Discuss any general programming issues here
Post Reply
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

Monospaced Fonts

Post by djrikki »

Hi Andreas,

For my textfields in Jack I am using the in-built font engine and the #MONO constant. However, according to some this typeface isn't be anti-aliased.

http://amigaworld.net/modules/news/arti ... oryid=6262
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
User avatar
airsoftsoftwair
Posts: 5887
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Monospaced Fonts

Post by airsoftsoftwair »

Please post a small code snippet that demonstrates the issue :)
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

Re: Monospaced Fonts

Post by djrikki »

Code: Select all

;; base:SetFont(mono,size,color,style)
; Set Font - Parameters: Monospaced Font = True/False, Font Size, Font Color, Style
Function base:SetFont(mono,size,color,style)
    If mono = true
        mono = #MONOSPACE
    Else
        mono = #SANS
    EndIf

    SetFont(mono,size, {Engine = #FONTENGINE_INBUILT})
    SetFontColor(color)
    SetFontStyle(style|#ANTIALIAS)
EndFunction

Global base
base = {}

base:SetFont(True,18,#BLACK,#NORMAL)

TextOut(#CENTER,#CENTER,"Hollywood Rocks")
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
jalih
Posts: 281
Joined: Fri Jun 18, 2010 8:08 pm
Location: Finland

Re: Monospaced Fonts

Post by jalih »

You are combining #NORMAL style with #ANTIALIAS style... #NORMAL style cannot be combined with anything!

edit your SetFont method, change:

Code: Select all

SetFontStyle(style|#ANTIALIAS)
to:

Code: Select all

SetFontStyle(style)
And edit your call to SetFont method to:

Code: Select all

base:SetFont(True,18,#BLACK,#ANTIALIAS)

So, it's something like this:

Code: Select all

base = {}

;; base:SetFont(mono,size,color,style)
; Set Font - Parameters: Monospaced Font = True/False, Font Size, Font Color, Style
Function base:SetFont(mono,size,color,style)
    If mono = True
        mono = #MONOSPACE
    Else
        mono = #SANS
    EndIf

    SetFont(mono,size, {Engine = #FONTENGINE_INBUILT})
    SetFontColor(color)
    SetFontStyle(style)
EndFunction



base:SetFont(True,64,#WHITE,#ANTIALIAS)

TextOut(#CENTER,#CENTER,"Hollywood Rocks")

WaitLeftMouse()
Post Reply