Page 1 of 1

Monospaced Fonts

Posted: Tue Feb 28, 2012 8:37 pm
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

Re: Monospaced Fonts

Posted: Fri Mar 02, 2012 12:53 pm
by airsoftsoftwair
Please post a small code snippet that demonstrates the issue :)

Re: Monospaced Fonts

Posted: Sat Mar 03, 2012 8:04 pm
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")

Re: Monospaced Fonts

Posted: Sat Mar 03, 2012 9:11 pm
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()