From 4a0d9c29b8e6828b322930efa53002e073793f2c Mon Sep 17 00:00:00 2001 From: Ryan Oldenburg Date: Wed, 27 Oct 2021 16:44:22 -0500 Subject: [PATCH] morepretty --- examples/realtime_wnim.nim | 2 +- src/pixie/fontformats/opentype.nim | 4 +++- tests/test_bmp.nim | 5 +++-- tests/test_images_draw.nim | 8 ++++---- tests/validate_fonts.nim | 12 ++++++------ 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/examples/realtime_wnim.nim b/examples/realtime_wnim.nim index 52a92a6..976dfcf 100644 --- a/examples/realtime_wnim.nim +++ b/examples/realtime_wnim.nim @@ -10,7 +10,7 @@ var frameCount = 0 image = Image(w, h) app = App() - frame = Frame(title="wNim/Pixie") + frame = Frame(title = "wNim/Pixie") proc draw() = # draw shiny sphere on gradient background diff --git a/src/pixie/fontformats/opentype.nim b/src/pixie/fontformats/opentype.nim index c7d2b8e..c4e0107 100644 --- a/src/pixie/fontformats/opentype.nim +++ b/src/pixie/fontformats/opentype.nim @@ -808,7 +808,9 @@ proc parseKernTable(buf: string, offset: int): KernTable = else: failUnsupported("Kern version") -proc parseCFFIndexOffsets(buf: string, start: var int, stripZero = false): seq[(int, int)] = +proc parseCFFIndexOffsets( + buf: string, start: var int, stripZero = false +): seq[(int, int)] = proc getOffset(buf: string, offset, offSize: int): int = var v = 0 diff --git a/tests/test_bmp.nim b/tests/test_bmp.nim index 40080fe..78b8c5d 100644 --- a/tests/test_bmp.nim +++ b/tests/test_bmp.nim @@ -32,6 +32,7 @@ import chroma, pixie, pixie/fileformats/bmp block: for bits in [32, 24]: - let image = - decodeBmp(readFile("tests/fileformats/bmp/knight." & $bits & ".master.bmp")) + let image = decodeBmp(readFile( + "tests/fileformats/bmp/knight." & $bits & ".master.bmp" + )) writeFile("tests/fileformats/bmp/knight." & $bits & ".bmp", encodeBmp(image)) diff --git a/tests/test_images_draw.nim b/tests/test_images_draw.nim index b0a5ade..f330598 100644 --- a/tests/test_images_draw.nim +++ b/tests/test_images_draw.nim @@ -244,10 +244,10 @@ block: b = readImage(&"tests/images/turtle.png") a.fill(rgba(255, 255, 255, 255)) let m = translate(vec2(50, 50)) * rotate(-5.toRadians) - a.draw(b, m * translate(vec2(0,0))) - a.draw(b, m * translate(vec2(-40,0))) - a.draw(b, m * translate(vec2(-40,-40))) - a.draw(b, m * translate(vec2(0,-40))) + a.draw(b, m * translate(vec2(0, 0))) + a.draw(b, m * translate(vec2(-40, 0))) + a.draw(b, m * translate(vec2(-40, -40))) + a.draw(b, m * translate(vec2(0, -40))) doDiff(a, "smooth12") block: diff --git a/tests/validate_fonts.nim b/tests/validate_fonts.nim index 131c3e1..3f42bc4 100644 --- a/tests/validate_fonts.nim +++ b/tests/validate_fonts.nim @@ -2,10 +2,10 @@ import pixie, stb_truetype, unicode let fontFiles = [ # "tests/fonts/Roboto-Regular_1.ttf" - # "tests/fonts/Aclonica-Regular_1.ttf" - # "tests/fonts/Ubuntu-Regular_1.ttf" - # "tests/fonts/IBMPlexSans-Regular_2.ttf" - # "tests/fonts/NotoSans-Regular_4.ttf" + # "tests/fonts/Aclonica-Regular_1.ttf" + # "tests/fonts/Ubuntu-Regular_1.ttf" + # "tests/fonts/IBMPlexSans-Regular_2.ttf" + # "tests/fonts/NotoSans-Regular_4.ttf" "tests/fonts/Pacifico-Regular_4.ttf" ] @@ -38,5 +38,5 @@ for fontFile in fontFiles: echo "DISAGREE: ", a, " != ", b, " <<<<<<<<<<<<<<<<<<<<<<<<<<<" # quit() - # echo stbtt.getCodepointKernAdvance(Rune('r'), Rune('s')).float32 - # echo font.typeface.getKerningAdjustment(Rune('r'), Rune('s')) + # echo stbtt.getCodepointKernAdvance(Rune('r'), Rune('s')).float32 + # echo font.typeface.getKerningAdjustment(Rune('r'), Rune('s'))