Hello Pranay,
I don't know of any way to do what you suggest with a generic font.
I'm afraid it doesn't generally make sense. Let me explain why.
You mention kerning, which is an adjustment on letter spacing, based
on the shape of consecutive letters.
But many very non-monospaced fonts are not kerned at all. Kerning is
not what makes a font non-monospaced.
The glyphs (the graphical representation of the letters) in a font
have intrinsic widths. For instance, in a
proportional font I have before me, the glyph for the letter 'i' has a
width of 278, while the glyph of 'm' has
width 779. This is what makes the font proportional, and not
monospaced. In a monospaced fonts, all the
glyphs have the same width (technically, some may be zero witdh as
well, but all the nonzero-width glyphs
must have the same width.)
It is conceivable to make a font that would *un-do* the intrinsic
spacing of the letters using a positioning adjustment
such as kerning, but *nobody* has ever done that -- it's contrary to
the usual purpose of positioning.
I don't know your application, but your options might include:
* An algorithm that calculates the width of the widest character you
wish to display,
and in evenly placed boxes of that width, to place a string
consisting of one letter centered in each box.
* ...? that's all I can think of...
Cheers!
P.S., By the way, Pango is on the way out in the Linux world. It's
being replaced by Harfbuzz, which better
emulates modern Windows behavior.
> _______________________________________________
On Thu, May 9, 2013 at 7:50 AM, Pranay Samanta
<pranay samanta work gmail com> wrote:
> Hi All,
>
> I need to know if there is any way in pango to make a non-monospace font
> look like monospace fonts i.e. the spacing between all the characters are
> same.
> I was planning to add a new script engine like basic-fc.c and set the glyph
> width to some value.
>
> I guess that I will have to ignore the kerning values to implement this.
>
> Please suggest me if I it is the right way to proceed, or if there are any
> trade-offs?
>
> In case, this is a good idea, I know that I have to change module-defs-fc.c
> and module-defs.h files. Are there any other files also that need to be
> changed ?
>
>
> --
> Thanks and Regards
> -----------------
>
> Pranay Samanta
>
> gtk-i18n-list mailing list
> gtk-i18n-list gnome org
> https://mail.gnome.org/mailman/listinfo/gtk-i18n-list
>