Mercurial Hosting > luan
view src/luan/modules/swing/Font.luan @ 1626:cf9dfead83a3
use Config.postgres
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 07 Dec 2021 18:30:02 -0700 |
parents | 915cb538e2a3 |
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