Mercurial Hosting > luan
view src/luan/modules/swing/Font.luan @ 1616:915cb538e2a3
start swing
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 05 Jun 2021 21:42:29 -0600 |
parents | |
children |
line wrap: on
line source
local Luan = require "luan:Luan.luan" local error = Luan.error local pairs = Luan.pairs or error() require "java" local JFont = require "java:java.awt.Font" local TextAttribute = require "java:java.awt.font.TextAttribute" local Font = {} local keys = { family = TextAttribute.FAMILY size = TextAttribute.SIZE } function Font.get(attrs) local jattrs = {} for key, val in pairs(attrs) do key = keys[key] or error("invalid font key: "..key) jattrs[key] = val end return JFont.getFont(jattrs) end return Font