From 870d6acd4d14fe474454fe4e07d01233a490c49f Mon Sep 17 00:00:00 2001 From: adam Date: Sun, 9 Jan 2005 09:23:11 +0000 Subject: [PATCH] added background color option to Font.drawGlyph() darcs-hash:20050109092311-5007d-dee0405ccf2b22c6986337bbd48d869fd49e9848.gz --- src/org/ibex/graphics/Font.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/org/ibex/graphics/Font.java b/src/org/ibex/graphics/Font.java index 1f8f35c..8e29b22 100644 --- a/src/org/ibex/graphics/Font.java +++ b/src/org/ibex/graphics/Font.java @@ -68,6 +68,9 @@ public class Font { * @returns (width<<32)|height */ public long rasterizeGlyphs(String text, PixelBuffer pb, int textcolor, int x, int y, int cx1, int cy1, int cx2, int cy2) { + return rasterizeGlyphs(text, pb, textcolor, x, y, cx1, cy1, cx2, cy2, 0); } + public long rasterizeGlyphs(String text, PixelBuffer pb, int textcolor, int x, int y, + int cx1, int cy1, int cx2, int cy2, int bg) { int width = 0, height = 0; if (!latinCharsPreloaded) { // preload the Latin-1 charset with low priority (we'll probably want it) for(int i=48; i<57; i++) if (glyphs[i]==null) glyphsToBeCached.put(glyphs[i]=Platform.createGlyph(this, (char)i),""); @@ -84,7 +87,14 @@ public class Font { Glyph g = glyphs[c]; if (g == null) glyphs[c] = g = Platform.createGlyph(this, c); g.render(); - if (pb != null) pb.drawGlyph(g, x + width, y + g.font.max_ascent - g.baseline, cx1, cy1, cx2, cy2, textcolor); + if (pb != null) pb.drawGlyph(g, + x + width, + y + g.font.max_ascent - g.baseline, + x+width, + cy1, + x+width+g.advance, + cy2, + textcolor, bg); width += g.advance; height = java.lang.Math.max(height, max_ascent + max_descent); } -- 1.7.10.4