diff --git a/main.lua b/main.lua index 84fcde1..8bddb52 100644 --- a/main.lua +++ b/main.lua @@ -36,6 +36,8 @@ function App.initialize_globals() -- blinking cursor Cursor_time = 0 + Font_height = 20 + -- for hysteresis in a few places Current_time = 0 Last_focus_time = 0 -- https://love2d.org/forums/viewtopic.php?p=249700 @@ -112,8 +114,8 @@ function load_settings() App.screen.move(settings.x, settings.y, settings.displayindex) if on.load_settings then on.load_settings(settings.app) end else - local font_height = 20 - love.graphics.setFont(love.graphics.newFont(font_height)) + Font_height = 20 + love.graphics.setFont(love.graphics.newFont(Font_height)) local os = love.system.getOS() if os == 'Android' or os == 'iOS' then -- maximizing on iOS breaks text rendering: https://github.com/deltadaedalus/vudu/issues/7 diff --git a/reference.md b/reference.md index 66a6bf5..a9064ed 100644 --- a/reference.md +++ b/reference.md @@ -21,6 +21,10 @@ two categories. * `flags` -- some properties of the app window. See [`flags` in `love.graphics.getMode`](https://love2d.org/wiki/love.window.getMode) for details. +* `Font_height` -- remembers the current font height on initialization. But + you're responsible for setting it when updating font height. (Think of this + as the body font, but apps so far assume a single font size.) + ## Functions you can implement that will get automatically called * `on.initialize(arg)` -- called when app starts up. Provides in `arg` an @@ -237,6 +241,9 @@ early warning if you break something. this for the most part, just run it after loading or modifying `state.lines`. +* `edit.update_font_height(state, font_height)` -- updates all state dependent + on font height. + If you need more precise control, look at the comment at the top of `edit.initialize_state` in edit.lua. In brief, the widget contains an array of `lines`. Positions in the buffer are described in _schema-1_ locations