From c8a8f4f90f826a99096e46eea7df2acea56f3ffd Mon Sep 17 00:00:00 2001 From: treeform Date: Mon, 25 May 2026 09:06:49 -0700 Subject: [PATCH 1/2] Fix binding ABI value types --- bindings/bindings.nim | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/bindings/bindings.nim b/bindings/bindings.nim index 4f4fc479..682f75fb 100644 --- a/bindings/bindings.nim +++ b/bindings/bindings.nim @@ -10,10 +10,10 @@ proc checkError(): bool = result = lastError != nil type - Vector2* = object + Vector2* {.bycopy.} = object x*, y*: float32 - Matrix3* = object + Matrix3* {.bycopy.} = object values*: array[9, float32] proc matrix3(): Matrix3 = @@ -34,6 +34,21 @@ proc scale(x, y: float32): Matrix3 = proc inverse(m: Matrix3): Matrix3 = cast[Matrix3](inverse(cast[Mat3](m))) +proc hasGlyph(typeface: Typeface, rune: int32): bool {.raises: [].} = + typeface.hasGlyph(Rune(rune)) + +proc getGlyphPath(typeface: Typeface, rune: int32): Path {.raises: [].} = + try: + result = typeface.getGlyphPath(Rune(rune)) + except: + lastError = currentExceptionAsPixieError() + +proc getAdvance(typeface: Typeface, rune: int32): float32 {.raises: [].} = + typeface.getAdvance(Rune(rune)) + +proc getKerningAdjustment(typeface: Typeface, left, right: int32): float32 {.raises: [].} = + typeface.getKerningAdjustment(Rune(left), Rune(right)) + proc parseColor(s: string): Color {.raises: [PixieError]} = try: result = parseHtmlColor(s) @@ -193,10 +208,10 @@ exportRefObject Typeface: descent lineGap lineHeight - hasGlyph - getGlyphPath - getAdvance - getKerningAdjustment + hasGlyph(Typeface, int32) + getGlyphPath(Typeface, int32) + getAdvance(Typeface, int32) + getKerningAdjustment(Typeface, int32, int32) newFont exportRefObject Font: From 9e095eb4431807d189b2a6de95cf863f1821fede Mon Sep 17 00:00:00 2001 From: treeform Date: Mon, 25 May 2026 09:42:28 -0700 Subject: [PATCH 2/2] Remove Pixie Rune ABI wrappers --- bindings/bindings.nim | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/bindings/bindings.nim b/bindings/bindings.nim index 682f75fb..118959da 100644 --- a/bindings/bindings.nim +++ b/bindings/bindings.nim @@ -34,21 +34,6 @@ proc scale(x, y: float32): Matrix3 = proc inverse(m: Matrix3): Matrix3 = cast[Matrix3](inverse(cast[Mat3](m))) -proc hasGlyph(typeface: Typeface, rune: int32): bool {.raises: [].} = - typeface.hasGlyph(Rune(rune)) - -proc getGlyphPath(typeface: Typeface, rune: int32): Path {.raises: [].} = - try: - result = typeface.getGlyphPath(Rune(rune)) - except: - lastError = currentExceptionAsPixieError() - -proc getAdvance(typeface: Typeface, rune: int32): float32 {.raises: [].} = - typeface.getAdvance(Rune(rune)) - -proc getKerningAdjustment(typeface: Typeface, left, right: int32): float32 {.raises: [].} = - typeface.getKerningAdjustment(Rune(left), Rune(right)) - proc parseColor(s: string): Color {.raises: [PixieError]} = try: result = parseHtmlColor(s) @@ -208,10 +193,10 @@ exportRefObject Typeface: descent lineGap lineHeight - hasGlyph(Typeface, int32) - getGlyphPath(Typeface, int32) - getAdvance(Typeface, int32) - getKerningAdjustment(Typeface, int32, int32) + hasGlyph + getGlyphPath + getAdvance + getKerningAdjustment newFont exportRefObject Font: