It is currently Thu Jan 21, 2021 6:15 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: default font
PostPosted: Mon Oct 18, 2010 10:09 am 
Offline
Enthusiast
Enthusiast

Joined: Thu Aug 26, 2010 8:26 am
Posts: 138
How to set default font?

story:
i wrote (2) test app (irc server and client)
compiled client in ubuntu 10.10 width demo 4.5
it works but fonts are bigger than in win

another question... visual designer in linux how? any link?

_________________
Registered user of PB (on Kubuntu 14.04 64bit & Win 10 64bit)


Top
 Profile  
Reply with quote  
 Post subject: Re: default font
PostPosted: Tue Oct 19, 2010 11:43 am 
Offline
Addict
Addict

Joined: Thu Aug 30, 2007 11:54 pm
Posts: 1287
Location: right here
for gadgets:
Code:
SetGadgetFont(#PB_Default, FontID)
it's in the manual.
for 2d drawing i don't know.


Top
 Profile  
Reply with quote  
 Post subject: Re: default font
PostPosted: Tue Oct 19, 2010 1:44 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Aug 11, 2009 1:56 pm
Posts: 858
Location: Essen (Germany)
sartic wrote:
it works but fonts are bigger than in win
but doesn't that depend on the local OS / user settings or monitor resolutions ?

sartic wrote:
visual designer in linux how?
how to what ?

_________________
Two growing code-collections: WinApi-Lib by RSBasic ~ LinuxAPI-Lib by Omi

Missing a download-file on the forums? ~ check out this backup page.


Top
 Profile  
Reply with quote  
 Post subject: Re: default font
PostPosted: Tue Oct 19, 2010 3:48 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Aug 26, 2010 8:26 am
Posts: 138
Vera wrote:
sartic wrote:
it works but fonts are bigger than in win
but doesn't that depend on the local OS / user settings or monitor resolutions ?

sartic wrote:
visual designer in linux how?
how to what ?


:) or better where is it ?

is there a designer in linux demo?

_________________
Registered user of PB (on Kubuntu 14.04 64bit & Win 10 64bit)


Top
 Profile  
Reply with quote  
 Post subject: Re: default font
PostPosted: Tue Oct 19, 2010 3:50 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Aug 26, 2010 8:26 am
Posts: 138
ok, i will try both.

same app (win exe) under wine have no big problems.

_________________
Registered user of PB (on Kubuntu 14.04 64bit & Win 10 64bit)


Top
 Profile  
Reply with quote  
 Post subject: Re: default font
PostPosted: Tue Oct 19, 2010 5:22 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Aug 11, 2009 1:56 pm
Posts: 858
Location: Essen (Germany)
sartic wrote:
:) or better where is it ?
is there a designer in linux demo?
No - the Visual Designer for Linux is not part of any distribution but you can find all you need here: Visual Designer V4 Alpha 16 Windows and Linux Released
and this might be of interest too: Does Visual Designer actually work in Linux?

and for more infos you may also use this SEARCH feature ;)

good luck ~ Vera

_________________
Two growing code-collections: WinApi-Lib by RSBasic ~ LinuxAPI-Lib by Omi

Missing a download-file on the forums? ~ check out this backup page.


Top
 Profile  
Reply with quote  
 Post subject: Re: default font
PostPosted: Tue Oct 19, 2010 8:31 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Aug 26, 2010 8:26 am
Posts: 138
thx ;)

_________________
Registered user of PB (on Kubuntu 14.04 64bit & Win 10 64bit)


Top
 Profile  
Reply with quote  
 Post subject: Re: default font
PostPosted: Sun Apr 29, 2012 12:20 pm 
Offline
User
User
User avatar

Joined: Mon Apr 04, 2011 3:56 am
Posts: 53
Location: Russia,Angarsk
How to know the name of the default font Gadget?

_________________
Linux Mint Maya(Mate), x86, PureBasic 5.00(5.10b1)


Top
 Profile  
Reply with quote  
 Post subject: Re: default font
PostPosted: Wed Jan 02, 2013 3:16 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Apr 21, 2005 2:38 pm
Posts: 1790
Location: Germany
lakomet wrote:
How to know the name of the default font Gadget?

A gadget's current font name and font's size can be obtained with the following code:
Code:
EnableExplicit

ImportC ""
  pango_context_get_font_description(*PangoContext)
  pango_font_description_to_string(*PangoFontDescription)
EndImport

Procedure GetGadgetFontInfos(GadgetID.I)
  Protected *FontDescription
  Protected PangoContext.I
  Protected PangoFontDescription.I

  PangoContext = gtk_widget_get_pango_context_(GadgetID(GadgetID))

  If PangoContext
    PangoFontDescription = pango_context_get_font_description(PangoContext)

    If PangoFontDescription
      *FontDescription = pango_font_description_to_string(PangoFontDescription)

      If *FontDescription
        MessageRequester("Info", PeekS(*FontDescription))
      EndIf
    EndIf
  EndIf
EndProcedure

OpenWindow(0, 270, 100, 170, 45, "Font infos")
ButtonGadget(0, 10, 10, WindowWidth(0) - 20, 25, "Get font infos")

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Break
    Case #PB_Event_Gadget
      If EventGadget() = 0 And EventType() = #PB_EventType_LeftClick
        GetGadgetFontInfos(0)
      EndIf
  EndSelect
ForEver


Top
 Profile  
Reply with quote  
 Post subject: Re: default font
PostPosted: Sun Jan 06, 2013 3:14 pm 
Offline
Enthusiast
Enthusiast

Joined: Tue Jan 25, 2005 7:01 pm
Posts: 460
Location: Canada
Does work on Ubuntu, thank you :3

Just a small correction so it work in unicode compilation mode:
Code:
    EnableExplicit

    ImportC ""
      pango_context_get_font_description(*PangoContext)
      pango_font_description_to_string(*PangoFontDescription)
    EndImport

    Procedure GetGadgetFontInfos(GadgetID.I)
      Protected *FontDescription
      Protected PangoContext.I
      Protected PangoFontDescription.I

      PangoContext = gtk_widget_get_pango_context_(GadgetID(GadgetID))

      If PangoContext
        PangoFontDescription = pango_context_get_font_description(PangoContext)

        If PangoFontDescription
          *FontDescription = pango_font_description_to_string(PangoFontDescription)

          If *FontDescription
            MessageRequester("Info", PeekS(*FontDescription,MemorySize(*FontDescription),#PB_Ascii))
          EndIf
        EndIf
      EndIf
    EndProcedure

    OpenWindow(0, 270, 100, 170, 45, "Font infos")
    ButtonGadget(0, 10, 10, WindowWidth(0) - 20, 25, "Get font infos")

    Repeat
      Select WaitWindowEvent()
        Case #PB_Event_CloseWindow
          Break
        Case #PB_Event_Gadget
          If EventGadget() = 0 And EventType() = #PB_EventType_LeftClick
            GetGadgetFontInfos(0)
          EndIf
      EndSelect
    ForEver


Top
 Profile  
Reply with quote  
 Post subject: Re: default font
PostPosted: Sun Jan 06, 2013 6:00 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Dec 20, 2003 6:19 pm
Posts: 468
Location: Switzerland
You should call g_free_() on the *FontDescription memory.
See: http://developer.gnome.org/pango/stable ... -to-string

Also MemorySize() is wrong. Use -1 and hope Pango does
return correct strings. (Btw, it may be possible that the string
is UTF8, but I don't know anything about font families..)

_________________
Athlon64 3700+, 1024MB Ram, Radeon X1600


Top
 Profile  
Reply with quote  
 Post subject: Re: default font
PostPosted: Mon Jan 07, 2013 9:44 am 
Offline
Addict
Addict
User avatar

Joined: Thu Apr 21, 2005 2:38 pm
Posts: 1790
Location: Germany
Thank you Poshu for pointing out that the flag #PB_Ascii has to be added for compilation in Unicode mode and
thank you Remi for pointing out that the *FontDescription string has to be freed. I totally overlooked that... :oops:
I have updated my first code example:
Code:
EnableExplicit

ImportC ""
  pango_context_get_font_description(*PangoContext)
  pango_font_description_to_string(*PangoFontDescription)
EndImport

Procedure GetGadgetFontInfos(GadgetID.I)
  Protected *FontDescription
  Protected PangoContext.I
  Protected PangoFontDescription.I

  PangoContext = gtk_widget_get_pango_context_(GadgetID(GadgetID))

  If PangoContext
    PangoFontDescription = pango_context_get_font_description(PangoContext)

    If PangoFontDescription
      *FontDescription = pango_font_description_to_string(PangoFontDescription)

      If *FontDescription
        MessageRequester("Info", PeekS(*FontDescription, -1, #PB_Ascii))
        g_free_(*FontDescription)
      EndIf
    EndIf
  EndIf
EndProcedure

OpenWindow(0, 270, 100, 170, 45, "Font infos")
ButtonGadget(0, 10, 10, WindowWidth(0) - 20, 25, "Get font infos")

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Break
    Case #PB_Event_Gadget
      If EventGadget() = 0 And EventType() = #PB_EventType_LeftClick
        GetGadgetFontInfos(0)
      EndIf
  EndSelect
ForEver


Top
 Profile  
Reply with quote  
 Post subject: Re: default font
PostPosted: Tue Jun 09, 2020 10:13 pm 
Offline
Addict
Addict

Joined: Mon Nov 25, 2013 6:41 am
Posts: 843
How to get the name of the font by the font id?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: John Duchek and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye