Render Intelligent-only components; fonts follow the display direction

- SLText, TextSelect, DataRecord, FileBrowser pixel-exact against the Intelligent simulator;
  ComboBox and Switch with approximate anti-aliased edges; media/file components draw nothing
- fonts: header byte 3 = 0x0A + direction, glyphs in the direction's pixel order, Intelligent
  glyph data 4-byte aligned -- reproduces the Editor's own font conversion byte for byte
- Intelligent 3D frames: left edge drawn over the bottom edge

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-11-16 00:26:27 +01:00
1 parent 56062e1a3e
commit 49fee337d7
10 files changed
+334 -32

No files matched your search

+17
View File
@@ -95,6 +95,23 @@ class Format4(unittest.TestCase):
self.assertEqual(img.getpixel((1, 0))[3], 226) # 227 * 127 // 255 = 113 -> 226
self.assertEqual(img.getpixel((2, 0))[3], 2)
@unittest.skipUnless(HAVE_PIL, "needs Pillow")
def test_font_follows_project_direction(self):
# an Intelligent landscape project (0 degrees): glyphs row by row, header byte 3 = 0x0A,
# glyph data 4-byte aligned -- what the Editor converts a 90-degree font to
from nxhmi import project
h = project.new_project("NX8048P050_011")
f = fonts.from_ttf(None, 16)
n = project.add_font(h, f)
blob = h.read("%d.zi" % n)
self.assertEqual(blob[3], 0x0A)
back = fonts.Font.parse(blob)
self.assertEqual((back.direction, back.align), (0, True))
self.assertEqual(back.glyph("0").pixels, fonts.from_ttf(None, 16).glyph("0").pixels)
self.assertEqual(back.pack(), blob)
m = 0x2C + blob[17]
self.assertEqual((blob[m + 5] | blob[m + 6] << 8) % 4, 0)
@unittest.skipUnless(HAVE_PIL, "needs Pillow")
def test_image_roundtrip(self):
from PIL import Image