FontButton

English

FontButtonはOS標準のフォント選択画面を開き、FontDescriptorを返します。

表示例

FontButton on Ubuntu
Ubuntu
FontButton on Windows
Windows
FontButton on macOS
macOS

実行例

require "uing"

UIng.init

window = UIng::Window.new("FontButton Example", 300, 100, margined: true)
window.on_closing do
  UIng.quit
  true
end

font_button = UIng::FontButton.new do
  on_changed do |font_descriptor|
    window.msg_box("Font Changed", "Family: #{font_descriptor.family}\nSize: #{font_descriptor.size}")
  end
end

window.child = font_button
window.show

UIng.main
UIng.uninit

使い方

  • 新しい選択はon_changedで処理します。
  • 記述子はコールバック内、またはブロック形式のfontヘルパー内で使用します。

APIリファレンス · Galleryソース