Gimp-Forum.net
How to change the weight of a font in gimp? - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions)
+--- Thread: How to change the weight of a font in gimp? (/Thread-How-to-change-the-weight-of-a-font-in-gimp)



How to change the weight of a font in gimp? - adrianh - 10-04-2018

I'm assuming that this is a font weight issue.  I was doing a mockup of a dialog, so I took what we had and then tried to modify it by adding some extra stuff.  This is what I got:

[attachment=2162]

Can you tell which text doesn't belong? Wink

This is exactly the same font and font size with antialiasing and yet it looks lighter than the other text.  So I looked up if I could change the weight for a font in gimp but seems that it is not directly available.  The closest that I came up with was:  http://www.gimptalk.com/index.php?/topic/37042-adding-weight-to-text-in-gimp/

Which I don't understand.  Some retired staff member references:

Quote:To "fatten" your text: "Filters->Distorts->Value Propagate" with the More Opaque option.

To "outline" text: "Layer->Mask->Add Layer Mask" initialized to Inverted Alpha Channel. "Filters->Distorts->Value Propagate" the layer (not the mask) with the More Opaque option.

and

Quote:Note that the Value Propagate method for outlining creates the outline outside the text. If you want the outline inside the text then you would apply Value Propagate on the layermask with the More White option.

But I'm a bit fuzzy as to how to use the Value Propagate filter and what it is doing.  Can anyone help me?  Is there any possibility that font weight will be added to the gimp in the future?


RE: How to change the weight of a font in gimp? - rich2005 - 10-04-2018

It is known that Gimp 2.10.x renders text, especially small text on the light side. Some difference in anti-aliasing from previous versions. There was a bug report about this but not able to find it at the moment.

One way out is duplicate the text layer so that they reinforce each other.

example: https://i.imgur.com/cj6L6O3.jpg

Then merge them if editing text is no longer required.


RE: How to change the weight of a font in gimp? - adrianh - 10-04-2018

(10-04-2018, 05:30 PM)rich2005 Wrote: It is known that Gimp 2.10.x renders text, especially small text on the light side. Some difference in anti-aliasing from previous versions. There was a bug report about this but not able to find it at the moment.

One way out is duplicate the text layer so that they reinforce each other.

example: https://i.imgur.com/cj6L6O3.jpg

Then merge them if editing text is no longer required.

Ah, that is a simple way to fix.  Not perfect, but much better than it was.

This wasn't limited to 2.10.  I've seen something similar this in 2.8 as well.

Would be nice if a weight could also be applied to text. How would I ask for that to be added to gimp's backlog?

Thanks,


A


RE: How to change the weight of a font in gimp? - Ofnuts - 10-04-2018

Weight is part of the font design. You cannot make a font heavier by just applying a simple math transform to the light version.

Otherwise, bug reports and suggestions are here: https://gitlab.gnome.org/GNOME/gimp/issues


RE: How to change the weight of a font in gimp? - adrianh - 10-04-2018

(10-04-2018, 08:04 PM)Ofnuts Wrote: Weight is part of the font design. You cannot make a font heavier by just applying a simple math transform to the light version.
Sorry, I don't understand what you mean.  Are font's not being rendered by the OS?  I come from a Windows dev background where weight is part of the font attributes:

https://msdn.microsoft.com/en-us/library/ms931108.aspx

Is this not the case for other OSs?  That is what I was referring to when I said:


Quote:Would be nice if a weight could also be applied to text. 



RE: How to change the weight of a font in gimp? - Ofnuts - 10-05-2018

When you said "Is there any possibility that font weight will be added to the gimp in the future?" you implied that given a font, the software can compute a light or heavy version. This is not true. The font must come with several variants (each hand-tweaked by the font author) and all the software does is pick a specific variant. Each variant has specific "font attributes" (fonts work roughly the same in Windows, OSX and Linux, even if some font formats are trickier than other to use.


RE: How to change the weight of a font in gimp? - adrianh - 10-18-2018

(10-05-2018, 03:15 PM)Ofnuts Wrote: When you said "Is there any possibility that font weight will be added to the gimp in the future?" you implied that given a font, the software can compute a light or heavy version. This is not true.

Sorry, but it is, though I think I understand your confusion.

(10-05-2018, 03:15 PM)Ofnuts Wrote: The font must come with several variants (each hand-tweaked by the font author) and all the software does is pick a specific variant. Each variant has specific "font attributes" (fonts work roughly the same in Windows, OSX and Linux, even if some font formats are trickier than other to use.

What you are referring to may apply to bitmap fonts, which would require a different image tweak for a different weight and require that the font designer have to tweak them based on that attribute (and others).  Though I don't know the internals in detail, vector fonts (E.g. TrueType Fonts) are calculated based on splines.  Do they have tweaks for specific attributes?  Maybe, but they are still calculated with weight being one of the attributes taken into consideration.  Even if a font has several variants and GIMP is arbitrarily selecting one of them, the font would be selected based on specific attributes, where weight is one of them.

What I am proposing is to expose the weight attribute so as to allow the font to be display the same way as Windows does, or lighter (as GIMP is doing now) or perhaps even heavier if so desired.


RE: How to change the weight of a font in gimp? - Ofnuts - 10-18-2018

(10-18-2018, 04:45 PM)adrianh Wrote:
(10-05-2018, 03:15 PM)Ofnuts Wrote: When you said "Is there any possibility that font weight will be added to the gimp in the future?" you implied that given a font, the software can compute a light or heavy version. This is not true.

Sorry, but it is, though I think I understand your confusion.

(10-05-2018, 03:15 PM)Ofnuts Wrote: The font must come with several variants (each hand-tweaked by the font author) and all the software does is pick a specific variant. Each variant has specific "font attributes" (fonts work roughly the same in Windows, OSX and Linux, even if some font formats are trickier than other to use.

What you are referring to may apply to bitmap fonts, which would require a different image tweak for a different weight and require that the font designer have to tweak them based on that attribute (and others).  Though I don't know the internals in detail, vector fonts (E.g. TrueType Fonts) are calculated based on splines.  Do they have tweaks for specific attributes?  Maybe, but they are still calculated with weight being one of the attributes taken into consideration.  Even if a font has several variants and GIMP is arbitrarily selecting one of them, the font would be selected based on specific attributes, where weight is one of them.

What I am proposing is to expose the weight attribute so as to allow the font to be display the same way as Windows does, or lighter (as GIMP is doing now) or perhaps even heavier if so desired.

No. For most fonts, you cannot apply a mathematical transform to produce the Italic variant from the plain variant, for instance (in the Windows API you could apply a "shear" to fonts to make them look italic but it was a stopgap measure for font with no italic variant). And you can't either for the bold variant:

[attachment=2216]

Notice how the italic variant is radically different (more curves) while only some parts of the bold variant are enlarged (the size of the serif remains about the same). Another thing that doesn't show is the slightly different kerning. These are three different set of splines... Also many fonts (TrueType or OpenType, which are vector....) come with more weights than just plain and bold. If these could all be computed from the plain version, would not it be simpler to have a single font and a "weight" slider?

Furthermore, even within a given variant, computing a rendering at a given size is more complicated than it looks, the smaller sizes are slightly distorted to increase readability (if you ever wondered what the "Hinting" selector is about in the Text tool options).


RE: How to change the weight of a font in gimp? - adrianh - 10-19-2018

(10-18-2018, 10:09 PM)Ofnuts Wrote:
(10-18-2018, 04:45 PM)adrianh Wrote: Even if a font has several variants and GIMP is arbitrarily selecting one of them, the font would be selected based on specific attributes, where weight is one of them.

Also many fonts (TrueType or OpenType, which are vector....) come with more weights than just plain and bold. If these could all be computed from the plain version, would not it be simpler to have a single font and a "weight" slider?
Hmmm, it is unfortunate that the fonts don't use a transform to allow mathematical manipulation of the fonts, making a weight slider possible (though, it might be possible to interpolate between them, and maybe extrapolate beyond them, but that is beyond what I am asking).  As I said above, if it cannot be calculated using some transform, then GIMP could at least give the appropriate weight information to to OS to render the font with the specific attributes, even if it doesn't do all the points in between.