I have two layers. Layer one has the background image (some landscape) und layer two is colored. Layer two is above and I insert a text on top of layer two and merge it with layer two and then set text to transparent so I see the background layer. The problem is the character edges are not sharp. Is there a way to get sharp edges for the text?
It's somewhat unclear what you mean by the text being "not sharp", so I'll give a variety of possible suggestions below. But first, just to set a baseline, here's some ordinary text in the GIMP (16px Sans, antialiased, no hinting, scaled up 2x):
This already looks pretty sharp to me, but here are a few things you could do to make it even sharper:
1. Enable hinting:
Hinting is a method of adjusting the shapes of characters so that their edges better align with pixel boundaries. You can enable hinting in GIMP by clicking the text layer, selecting the text tool and checking the "Hinting" checkbox in the tool options. (It's enabled by default, but you might have disabled it.)
There's also another checkbox, "Force auto-hinter", which controls the actual hinting method GIMP will use: with the box unchecked, GIMP will follow any custom hinting instructions embedded in the font, whereas checking the box makes GIMP use only its own generic font-independent hinting algorithm. Either hinting method should make the text look sharper, but the results of the two methods can be quite different, as shown below (normal hinting on left, auto-hinter on right):
In this particular case, the auto-hinter doesn't change the appearance much, although if you compare it side-to-side with the unhinted version, you can see some sharpening. The custom-hinted version, however, looks very different, with most line widths adjusted to be exactly one pixel wide.
Note that, with hinting enabled, changing the font size by even a small amount can have a major effect on the appearance of the text. This is particularly true for fonts with aggressive hinting at at small sizes — with the auto-hinter, the changes are usually less pronounced.
2. Disable anti-aliasing:
The text tool options dialog also has a checkbox for disabling anti-aliasing entirely, so that every pixel of the text is either fully opaque or fully transparent. In some sense, this yields maximum sharpness, but usually at the cost of smoothness. If you do decide to turn off anti-aliasing, I'd strongly recommend enabling hinting, as you can see below (normal hinting on left, auto-hinter in middle, no hinting on right):
3. Add an outline:
Another possibility is that the "lack of sharpness" you describe is caused by the text blending in with the background, particularly if the background is "busy" or similar in color to the text, like in this example:
In that case, playing with hinting or anti-aliasing settings won't help, since the problem is lack of contrast between the text and the background. Instead, what you can do is surround the text with a high-contrast outline to separate it from the background. Here's one way to do it:
That's much more readable, isn't it? You can also tweak the outline in various ways, e.g. by blurring it:
or adjusting its opacity or, especially for a dark outline, moving the layer slightly to make it look like a drop shadow.
First off, I'd suggest not merging the text which should keep it sharper.