FontRequest and GetAttribute

Find quick help here to get you started with Hollywood
User avatar
Juan Carlos
Posts: 932
Joined: Mon Sep 06, 2010 1:02 pm

FontRequest and GetAttribute

Post by Juan Carlos »

I have found a problem when you load one font using the FontRequest I can't get the font properties because the instruction GetAttribute needs a number of Font here is the example:

Code: Select all

Fuente=FontRequest("Select one font")
SetFont(Fuente.name, Fuente.size) ;Here you get the name and size from the font.
SetFontColor(HexStr(Fuente.color)) ;I gives the font color.

 ;Here I try to get the anlialias, but the instruction GetAttribute needs a font number and with the FontRequest it is possible?
TextoAlias=GetAttribute(#FONT, Fuente, #ATTRFONTAA)
If TextoAlias=True
	SetFontStyle(#ANTIALIAS)
	SystemRequest("WARNING", "Font with antialias", "Ok", #REQICON_ERROR)
Else
	SystemRequest("WARNING", "Font without antialias", "ok", #REQICON_ERROR)
EndIf
TextOut(#CENTER, #CENTER, "TEXT OF TEST")

EscapeQuit(False)
Repeat
  WaitEvent
Forever
Is there any way to get the number of the font loaded with FontRequest for get all attributtes?
Thank you.
SamuraiCrow
Posts: 475
Joined: Fri May 15, 2015 5:15 pm
Location: Waterville, Minnesota USA

Re: FontRequest and GetAttribute

Post by SamuraiCrow »

I think you are looking for GetFontStyle(). GetAttribute() is only for fonts embedded using preprocessor macros because it is in the object library.
I'm on registered MorphOS using FlowStudio.
User avatar
Juan Carlos
Posts: 932
Joined: Mon Sep 06, 2010 1:02 pm

Re: FontRequest and GetAttribute

Post by Juan Carlos »

SamuraiCrow wrote: Wed Feb 12, 2020 10:55 am I think you are looking for GetFontStyle(). GetAttribute() is only for fonts embedded using preprocessor macros because it is in the object library.
Thank you for your idea but SetFontStyle isn't the solution because is not the same situation FontRequest than SetFontStyle.
User avatar
airsoftsoftwair
Posts: 5834
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: FontRequest and GetAttribute

Post by airsoftsoftwair »

You cannot get whether the font supports antialiasing because the system font requester doesn't return this information. This information is only available once a font is loaded so you need to load the font first.
User avatar
Juan Carlos
Posts: 932
Joined: Mon Sep 06, 2010 1:02 pm

Re: FontRequest and GetAttribute

Post by Juan Carlos »

airsoftsoftwair wrote: Sun Feb 16, 2020 12:07 am You cannot get whether the font supports antialiasing because the system font requester doesn't return this information. This information is only available once a font is loaded so you need to load the font first.
But un the Code already you load the Font with the requester and the antialias propertie is assigned and the Font is showed with this, but the GetAttribute hasn't this propertie.
User avatar
Juan Carlos
Posts: 932
Joined: Mon Sep 06, 2010 1:02 pm

Re: FontRequest and GetAttribute

Post by Juan Carlos »

The idea is to can distinguish the True Type Font of Amiga traditional Font to set the anti-alysing in the True Type because if you set for default the Amiga Font isn't showed.
User avatar
airsoftsoftwair
Posts: 5834
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: FontRequest and GetAttribute

Post by airsoftsoftwair »

Hollywood can't tell the type of a font without loading it so just load it, query #FONTAA and then free it again.
User avatar
Juan Carlos
Posts: 932
Joined: Mon Sep 06, 2010 1:02 pm

Re: FontRequest and GetAttribute

Post by Juan Carlos »

But there isn't LoadFont like LoadBrush to get attributes.
PEB
Posts: 576
Joined: Sun Feb 21, 2010 1:28 am

Re: FontRequest and GetAttribute

Post by PEB »

Try OpenFont().

Code: Select all

OpenFont(1, "Arial", 36)
DebugPrint(GetAttribute(#FONT, 1, #ATTRFONTAA))
CloseFont(1)
User avatar
Juan Carlos
Posts: 932
Joined: Mon Sep 06, 2010 1:02 pm

Re: FontRequest and GetAttribute

Post by Juan Carlos »

PEB wrote: Tue Feb 18, 2020 1:42 am Try OpenFont().

Code: Select all

OpenFont(1, "Arial", 36)
DebugPrint(GetAttribute(#FONT, 1, #ATTRFONTAA))
CloseFont(1)
No os this, I ask the Font with FontResquest.
Post Reply