html: improve text rendering

This commit is contained in:
Hannes Janetzek
2013-07-26 01:00:25 +02:00
parent e3dccea307
commit 3ab9751128
2 changed files with 11 additions and 6 deletions

View File

@@ -5,6 +5,7 @@ import org.oscim.backend.canvas.Bitmap;
import org.oscim.backend.canvas.Paint;
import com.google.gwt.canvas.dom.client.Context2d;
import com.google.gwt.canvas.dom.client.Context2d.LineJoin;
public class GwtCanvas implements org.oscim.backend.canvas.Canvas {
GwtBitmap bitmap;
@@ -28,15 +29,18 @@ public class GwtCanvas implements org.oscim.backend.canvas.Canvas {
GwtPaint p = (GwtPaint) paint;
Context2d ctx = bitmap.pixmap.getContext();
ctx.setFont(p.font);
ctx.setLineJoin(LineJoin.ROUND);
if (p.stroke){
//Log.d("", "stroke " + p.stroke + " " + p.color + " " + p.font + " "+ string);
ctx.setLineWidth(p.strokeWidth);
ctx.setStrokeStyle(p.color);
ctx.strokeText(string, x, y);
//ctx.strokeText(string, p.strokeWidth + x, p.strokeWidth + y);
ctx.strokeText(string, x + 1, y + 1);
} else{
//Log.d("", "fill " + p.stroke + " " + p.color + " " + p.font + " "+ string);
ctx.setFillStyle(p.color);
ctx.fillText(string, x, y);
ctx.fillText(string, x + 1, y + 1);
}
}