[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XForms] Help with XForms

From: Jens Thoms Toerring
Subject: Re: [XForms] Help with XForms
Date: Thu, 10 Apr 2014 23:57:43 +0200
User-agent: Mutt/1.5.21 (2010-09-15)


On Thu, Apr 10, 2014 at 03:13:04PM +0530, Sunny wrote:
> I am not able to change font/label sizes with fl_set_object_lsize(). I
> understand that not all sizes may be installed for that font on my
> system, but none of the FL_HUGE_SIZE, FL_LARGE_SIZEs worked.

The default choice of fonts is very, very conservative, i.e.
all (non-ancient) systems I've ever seen did have freely
scalable versions of the fonts used. Do you really get the
ugly "I don't know what else to use font"?

Which function for drawing the text are you using? (I have
to ask stuoid questions since also to me the font handling
isn't something I've dealt with a lot in recent times;-)

> My workaround is adding a fl_get_font_name() function which fetches
> the font-string and modifies the width and height field directly and
> set it via fl_set_font_name().

But none of these fields are set in the default fonts, they all
go like this


So if you set widths and heights you actually should reduce
the pool of fonts that can be used. I would have expected
that you would have to change the font name field.

> Is there a better alternative?

I think so. Currently 16 fonts are "pre-defined", but the
font table has 48 (FL_MAXFONTS) slots. Thus you should be
able to add 32 further fonts. That should be possible using

int fl_set_font_name( int n, const char * name );

function. 'n' is the index in the table (you can even
overwrite the default fonts), and 'name' is the X font
name - preferably, if it's a scalable font, containing a
'?' for the size field, so it can be scaled.

Once you have added a new font this way use the index 'n'
in fl_set_object_lstyle(). If the font is scalable (and has
a '?' in the size field) it should also react properly to

Please keep in mind that this is from (hazy) memort and a
short look into the sources, so it could be quite wrong...
So complain loudly if it doesn't work!

> Oh, while we are on this subject, can we add a corresponding
> fl_get_font_name() function to the library? It doesn't have one by
> default.
> --- a/fonts.c
> +++ b/fonts.c
> @@ -231,6 +231,18 @@ fl_set_font_name( int          n,
>      return try_get_font_struct( n, FL_DEFAULT_SIZE, 1 ) ? 0 : -1;
>  }
> +char *
> +fl_get_font_name( int index )
> +{
> +    if ( index < 0 || index >= FL_MAXFONTS )
> +    {
> +        M_warn( __func__, "Bad font index" );
> +        return NULL;
> +    }
> +
> +    return fl_fonts[index].fname;
> +}
> +

I'll definitely consider this, just please give me a bit
of time;-)
                         Best regards, Jens
  \   Jens Thoms Toerring  ________      address@hidden
   \_______________________________      http://toerring.de

reply via email to

[Prev in Thread] Current Thread [Next in Thread]