diff --git a/glyphme/TrueTypeFont.hx b/glyphme/TrueTypeFont.hx index 522142b..2c9250f 100644 --- a/glyphme/TrueTypeFont.hx +++ b/glyphme/TrueTypeFont.hx @@ -34,10 +34,20 @@ class TrueTypeFont extends h2d.Font { super(null, sizeInPixels, h2d.Font.FontType.SignedDistanceField(Red, alphaCutOff, smoothing)); - super.lineHeight = ascent - lineGap; + super.lineHeight = sizeInPixels; super.baseLine = ascent; super.tile = @:privateAccess new Tile(null, 0, 0, 0, 0); // to avoid null access } + + private var __forceHasChar:Bool = false; + + override function hasChar(code:Int):Bool { + if(code == Key.BACKSPACE) return false; + if(Key.isDown(Key.CTRL)) return false; + if (__forceHasChar) + return true; + return super.hasChar(code); + } /** Fallbacks are used to look up glyphs from multiple fonts. When a glyph is not found * we try the next font. If you have multiple fallbacks with slightly overlapping glyph support