From 8ed2ff3fa80b1e79786439425db69b964065fcda Mon Sep 17 00:00:00 2001 From: Jhynjhiruu Date: Wed, 8 Oct 2025 22:07:28 +0100 Subject: [PATCH] HTML5 implementation --- haxe/ui/backend/ComponentGraphicsImpl.hx | 10 ++++++++++ haxe/ui/backend/html5/graphics/SVGGraphicsImpl.hx | 13 +++++++++++++ 2 files changed, 23 insertions(+) diff --git a/haxe/ui/backend/ComponentGraphicsImpl.hx b/haxe/ui/backend/ComponentGraphicsImpl.hx index e76ad2d..106ae13 100644 --- a/haxe/ui/backend/ComponentGraphicsImpl.hx +++ b/haxe/ui/backend/ComponentGraphicsImpl.hx @@ -46,6 +46,16 @@ class ComponentGraphicsImpl extends ComponentGraphicsBase { super.fillStyle(color, alpha); _impl.fillStyle(color, alpha); } + + public override function fontStyle(size:Null, family:Null = null, anchor:Null = null) { + super.fontStyle(size, family, anchor); + _impl.fontStyle(size, family, anchor); + } + + public override function text(x:Float, y:Float, t:String) { + super.text(x, y, t); + _impl.text(x, y, t); + } public override function circle(x:Float, y:Float, radius:Float) { super.circle(x, y, radius); diff --git a/haxe/ui/backend/html5/graphics/SVGGraphicsImpl.hx b/haxe/ui/backend/html5/graphics/SVGGraphicsImpl.hx index c14b3bb..55ad4a8 100644 --- a/haxe/ui/backend/html5/graphics/SVGGraphicsImpl.hx +++ b/haxe/ui/backend/html5/graphics/SVGGraphicsImpl.hx @@ -5,6 +5,7 @@ import haxe.ui.backend.html5.svg.SVGBuilder; import haxe.ui.backend.html5.svg.SVGPathBuilder; import haxe.ui.backend.html5.svg.SVGStrokeData; import haxe.ui.backend.html5.svg.SVGFillData; +import haxe.ui.backend.html5.svg.SVGFontData; import haxe.ui.core.Component; import haxe.ui.geom.Point; import haxe.ui.loaders.image.ImageLoader; @@ -67,6 +68,18 @@ class SVGGraphicsImpl extends ComponentGraphicsBase { currentPath.fill(currentFillStyle); } } + + public override function fontStyle(size:Null, family:Null = null, anchor:Null = null) { + var currentFontStyle:SVGFontData = {}; + currentFontStyle.size = size; + currentFontStyle.family = family; + currentFontStyle.anchor = anchor; + _svg.currentFontStyle = currentFontStyle; + } + + public override function text(x:Float, y:Float, t:String) { + _svg.text(t, x, y); + } public override function circle(x:Float, y:Float, radius:Float) { _svg.circle(x, y, radius);