diff --git a/changelog.md b/changelog.md index aa661117..7689a00e 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,49 @@ Lite XL is following closely [rxi/lite](https://github.com/rxi/lite) but with so This files document the differences between Lite XL and rxi/lite for each version. +### 1.13 + +**Rendering options for fonts** + +When loading fonts with the function renderer.font.load some rendering options can +be optionally specified: + +- antialiasing: grayscale or subpixel +- hinting: none, slight or full + +See data/core/style.lua for the details about its utilisation. + +The default remains antialiasing subpixel and hinting slight to reproduce the +behavior of previous versions. +The option grayscale with full hinting is specially interesting for crisp font rendering +without color artifacts. + +**Unix-like install directories** + +Use unix-like install directories for the executable and for the data directory. +The executable will be placed under $prefix/bin and the data folder will be +$prefix/share/lite-xl. +The folder $prefix is not hard-coded in the binary but is determined at runtime +as the directory such as the executable is inside $prefix/bin. +If no such $prefix exist it will fall back to the old behavior and use the "data" +folder from the executable directory. + +In addtion to the `EXEDIR` global variable an additional variable is exposed, `DATADIR`, +to point to the data directory. + +The old behavior using the "data" directory can be still selected at compile time +using the "portable" option. The released Windows package will use the "data" +directory as before. + +**Configuration stored into the user's home directory** + +Now the Lite XL user's configuration will be stored in the user's home directory under +".config/lite-xl". +The home directory is determined using the "HOME" environment variable except on Windows +wher "USERPROFILE" is used instead. + +A new global variable `USERDIR` is exposed to point to the user's directory. + ### 1.11 - include changes from rxi's Lite 1.11 diff --git a/data/core/init.lua b/data/core/init.lua index 0ea433e4..df8ddf05 100644 --- a/data/core/init.lua +++ b/data/core/init.lua @@ -102,8 +102,15 @@ local function create_user_directory() end for _, dirname in ipairs(subdirs) do dirname_create = dirname_create .. '/' .. dirname - local success_mkdir = system.mkdir(dirname_create) - if not success_mkdir then error("cannot create directory: \"" .. dirname_create .. "\"") end + if not system.mkdir(dirname_create) then + error("cannot create directory: \"" .. dirname_create .. "\"") + end + end + for _, modname in ipairs(['plugins', 'colors']) do + local subdirname = dirname_create .. '/' .. modname + if not system.mkdir(subdirname) then + error("cannot create directory: \"" .. subdirname .. "\"") + end end end @@ -242,14 +249,16 @@ end function core.load_plugins() local no_errors = true - local files = system.list_dir(DATADIR .. "/plugins") - for _, filename in ipairs(files) do - local modname = "plugins." .. filename:gsub(".lua$", "") - local ok = core.try(require, modname) - if ok then - core.log_quiet("Loaded plugin %q", modname) - else - no_errors = false + for _, root_dir in ipairs([DATADIR, USERDIR]) do + local files = system.list_dir(root_dir .. "/plugins") + for _, filename in ipairs(files) do + local modname = "plugins." .. filename:gsub(".lua$", "") + local ok = core.try(require, modname) + if ok then + core.log_quiet("Loaded plugin %q", modname) + else + no_errors = false + end end end return no_errors diff --git a/data/core/style.lua b/data/core/style.lua index e8567de5..1084540d 100644 --- a/data/core/style.lua +++ b/data/core/style.lua @@ -13,14 +13,14 @@ style.tab_width = common.round(170 * SCALE) -- {antialiasing= "grayscale", hinting = "full"} -- -- The possible values for each option are: --- - for antialiang: grayscale, subpixel +-- - for antialiasing: grayscale, subpixel -- - for hinting: none, slight, full -- --- The defaults values are antialiang subpixel and hinting slight for optimal visualization +-- The defaults values are antialiasing subpixel and hinting slight for optimal visualization -- on ordinary LCD monitor with RGB patterns. -- --- On High DPI monitor or non RGB monitor you may consider using antialiang grayscale instead. --- The antialising grayscale with full hinting is interesting for crisp font rendering. +-- On High DPI monitor or non RGB monitor you may consider using antialiasing grayscale instead. +-- The antialiasing grayscale with full hinting is interesting for crisp font rendering. style.font = renderer.font.load(DATADIR .. "/fonts/font.ttf", 14 * SCALE) style.big_font = renderer.font.load(DATADIR .. "/fonts/font.ttf", 34 * SCALE) style.icon_font = renderer.font.load(DATADIR .. "/fonts/icons.ttf", 14 * SCALE, {antialiasing="grayscale", hinting="full"}) diff --git a/doc/usage.md b/doc/usage.md index 3b536cc5..5ea4e28e 100644 --- a/doc/usage.md +++ b/doc/usage.md @@ -41,8 +41,12 @@ The user module is loaded by lite when the application starts, after the plugins have been loaded. The user module can be modified by running the `core:open-user-module` command -or otherwise directly opening the `data/user/init.lua` file. +or otherwise directly opening the `$HOME/.config/lite-xl/init.lua` file. +As an exception, on Windows, the variable `$USERPROFILE` will be used instead of +`$HOME`. +Please note that Lite XL differs from the standard Lite editor for the location +of the user's module. ## Project Module The project module is an optional module which is loaded from the current @@ -119,14 +123,18 @@ Plugins in lite are normal lua modules and are treated as such — no complicated plugin manager is provided, and, once a plugin is loaded, it is never expected be to have to unload itself. -To install a plugin simply drop it in the `data/plugins` directory — installed -plugins will be automatically loaded when lite starts. To uninstall a plugin the +To install a plugin simply drop it in the `plugins` directory in the user +module directory. +When Lite XL starts it will first load the plugins included in the data directory +and will then loads the plugins located in the user module directory. + +To uninstall a plugin the plugin file can be deleted — any plugin (including those included with lite's default installation) can be deleted to remove its functionality. If you want to load a plugin only under a certain circumstance (for example, only on a given project) the plugin can be placed somewhere other than the -`data/plugins` directory so that it is not automatically loaded. The plugin can +`plugins` directory so that it is not automatically loaded. The plugin can then be loaded manually as needed by using the `require` function. Plugins can be downloaded from the [plugins repository](https://github.com/rxi/lite-plugins). @@ -134,12 +142,14 @@ Plugins can be downloaded from the [plugins repository](https://github.com/rxi/l ## Color Themes Colors themes in lite are lua modules which overwrite the color fields of lite's -`core.style` module. Color themes should be placed in the `data/user/colors` -directory. +`core.style` module. +Pre-defined color methods are located in the `colors` folder in the data directory. +Additional color themes can be installed in the user's directory in a folder named +`colors`. A color theme can be set by requiring it in your user module: ```lua -require "user.colors.winter" +require "colors.winter" ``` Color themes can be downloaded from the [color themes repository](https://github.com/rxi/lite-colors). diff --git a/src/main.c b/src/main.c index 1704a6f1..770f9bfb 100644 --- a/src/main.c +++ b/src/main.c @@ -102,7 +102,7 @@ int main(int argc, char **argv) { } lua_setglobal(L, "ARGS"); - lua_pushstring(L, "1.11"); + lua_pushstring(L, "1.13"); lua_setglobal(L, "VERSION"); lua_pushstring(L, SDL_GetPlatform());