Forum: Ruby-Gnome 2 bigger font size

Posted by hendra kusuma (Guest)
on 2011-10-22 06:40
(Received via mailing list)
Hi all

First, I want to thank you developer, for this great library. I like it 
so
much and it really helps me a lot
and now,
I'm currently making an app for elder people here
is there a way to make all font in my application bigger, rather than 
set
them one by one?

Thanks
Posted by Marc Heiler (shevegen)
on 2011-10-24 10:45
Hi!

I think it depends on how you want to try to solve it.

For instance, if you use Gnome::CanvasText you can do:


  @canvas_text = Gnome::CanvasText.new(@canvas_group,
    :x => 98.0,
    :y => 32.0,
    :font => "Sans 22",
    :anchor => Gtk::ANCHOR_CENTER,
    :text => "foobar",
    :fill_color => "black"
  )

And pass in the font value there.

If you want to modify the font of your window, you can do this:


@window.modify_font( 
Pango::FontDescription.new("#widget.settings.gtk_font_nameend 20" ) )

Where @window is of Gtk::Window type.


I think you can also use .modify_font on other widgets, for instance:

  DEFAULT_FONT = Pango::FontDescription.new("Sans 30")
  @label.modify_font(DEFAULT_FONT)

I am also using some constants for easier access like this:

  module PangoFonts

    FONT_SANS_BOLD_08 = Pango::FontDescription.new('Sans Bold 08')
    FONT_SANS_BOLD_10 = Pango::FontDescription.new('Sans Bold 10')
    FONT_SANS_BOLD_11 = Pango::FontDescription.new('Sans Bold 11')
    FONT_SANS_BOLD_12 = Pango::FontDescription.new('Sans Bold 12')
    FONT_SANS_BOLD_14 = Pango::FontDescription.new('Sans Bold 14')
    FONT_SANS_BOLD_16 = Pango::FontDescription.new('Sans Bold 16')
    FONT_SANS_BOLD_18 = Pango::FontDescription.new('Sans Bold 18')

    FONT_UTOPIA_14 = Pango::FontDescription.new('Utopia 14')
    FONT_UTOPIA_16 = Pango::FontDescription.new('Utopia 16')
    FONT_UTOPIA_18 = Pango::FontDescription.new('Utopia 18')
    FONT_UTOPIA_20 = Pango::FontDescription.new('Utopia 20')

  end

In a VTE Terminal you could do this:

@vte_terminal.set_font('Monospace 28', 
Vte::TerminalAntiAlias::FORCE_ENABLE)


Not sure if this is helping you, sorry, but perhaps it can be a start. 
:)

There is probably also an easier way to handle font size in general, I 
am just not sure about it (The GTK way ...)
Posted by Michal Suchanek (Guest)
on 2011-10-24 11:11
(Received via mailing list)
On 22 October 2011 06:40, hendra kusuma <penguinroad@gmail.com> wrote:
> Hi all
>
> First, I want to thank you developer, for this great library. I like it so
> much and it really helps me a lot
> and now,
> I'm currently making an app for elder people here
> is there a way to make all font in my application bigger, rather than set
> them one by one?

Maybe rather than setting font size specifically for your application
it would be more useful to set large font size in gtk theme so that
all applications get large fonts?

HTH

Michal
Posted by Marc Heiler (shevegen)
on 2011-10-24 21:23
In CSS this would be kind of easy.

body {
  font-size: 2em;
}

And reuse the .css files or load another one.
Posted by Geoff Youngs (Guest)
on 2011-10-24 21:40
(Received via mailing list)
On 22 October 2011 05:40, hendra kusuma <penguinroad@gmail.com> wrote:
>
> Hi all
>
> First, I want to thank you developer, for this great library. I like it so much 
and it really helps me a lot
> and now,
> I'm currently making an app for elder people here
> is there a way to make all font in my application bigger, rather than set them 
one by one?

If it's a desktop application to run on your user's computer, it'd be
much better to point them towards the control panel to increase the
font size for all their applications.

If it's the only application the target users will have access to/use
on the machine, then it may be worth overriding the default setting
for your application in Gtk::Settings

e.g.
Gtk::Settings.default.gtk_font_name="Sans 24"

--
Random Musing - http://www.frafferz.com/
Geek Blog - http://geoffyoungs.github.com/
Posted by hendra kusuma (Guest)
on 2011-10-25 10:10
(Received via mailing list)
Thank you all for your reply

Gtk::Settings.default.gtk_font_name="Sans 24"

this line works like charm
of course 24 is too big :)

sorry, been away for a moment from this project because my other project
needs attention.

I'd rather not change all desktop font, since basically it's a general
application
that can be used by all, not just elders

it's a karaoke program :D

or to be precise, it's a front end to choose and queue song to play in 
VLC,
ala karaoke suite
I make this for my father, he likes singing a lot.
And most likely my girlfriend will also use this since she likes singing 
too
:)

Thanks
Regards
Posted by Marc Heiler (shevegen)
on 2011-10-27 01:59
> it's a karaoke program :D

Haha great idea! Hope it'll work nicely :D

> it's a front end to choose and queue song to play in VLC

Hmm how do you play it in VLC? Do you actually embed VLC?
Because that would be kind of awesome!
Posted by hendra kusuma (Guest)
on 2011-10-27 06:37
(Received via mailing list)
On Thu, Oct 27, 2011 at 7:59 AM, Marc Heiler <
ruby-forum-incoming@andreas-s.net> wrote:

> > it's a karaoke program :D
>
> Haha great idea! Hope it'll work nicely :D
>

Thanks :)
it's almost finished. I still have a problem I haven't solved yet
Hope to finish it soon
Posted by hendra kusuma (Guest)
on 2011-10-31 05:32
(Received via mailing list)
On Thu, Oct 27, 2011 at 7:59 AM, Marc Heiler <
ruby-forum-incoming@andreas-s.net> wrote:

> > it's a karaoke program :D
>
> Haha great idea! Hope it'll work nicely :D
>
> --
> Posted via http://www.ruby-forum.com/.
>

Your other question don't show in gmail for unknown reason. I just find 
it
out when googling

Hmm how do you play it in VLC? Do you actually embed VLC?
Because that would be kind of awesome!

For the time being, I use VLC itself in remote control mode
and control it using popen4 library to input stdin
and I use a very rough/bad method to get stdout since popen4 can't get
stdout without closing stdin or seems like it
but it's already in usable state.

I want to release this, but installation won't be as easy as next next
finish
as I don't know anything about making installer in Ruby

I actually do some research to embed vlc, there something at
http://www.gtkforums.com/viewtopic.php?t=4285
that shows it can be done, but it's in C, not Ruby
and I sucks at C -_-;

Can't seem to find any ruby related about this
If you guys know anything to do so,
a help or pointer would be very helpful

Thanks
Posted by Marc Heiler (shevegen)
on 2011-11-03 22:32
> Your other question don't show in gmail for
> unknown reason.

Hmm. I am using ruby-forum.com to post content.

There is a little checkbutton "Enable email notification"
which I usually do not check, before I hit "Submit".

I try with this post though, perhaps you will see
a difference? If so then that may have been the reason.

By the way, thank you for that information, really
appreciate it. :)
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.