html: improve text rendering
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user