Refactor Java to shared kotlin

This commit is contained in:
James Babcock committed 2026-09-18 22:48:20 -07:00
1 parent bc8e80c533
commit 68810197a8
173 files changed
+9855 -6252

No files matched your search

+5 -16
View File
@@ -1,16 +1,5 @@
import { LvglFont } from '../graphics/lvgl-font'
import { readBinaryFile } from './file-access'
const cache = new Map<string, LvglFont>()
function load(path: string): LvglFont {
let font = cache.get(path)
if (!font) {
const bytes = readBinaryFile(path)
if (!bytes) throw new Error('Cannot read LVGL font')
font = new LvglFont(bytes)
if (cache.size >= 2) cache.delete(cache.keys().next().value!)
cache.set(path, font)
}
return font
}
export function lvglMetrics(path: string): Uint8Array { return load(path).metrics }
export function lvglGlyph(path: string, codePoint: number): Uint8Array { return load(path).glyph(codePoint) }
import { fromData } from './kotlin-data'
declare const FaceclawKitIosProtocol: any
const protocol = FaceclawKitIosProtocol.new()
export function lvglMetrics(path: string): Uint8Array { return fromData(protocol.fontMetricsPath(path)) }
export function lvglGlyph(path: string, codePoint: number): Uint8Array { return fromData(protocol.fontGlyphPathCodePoint(path, codePoint)) }