From c34b9191f258ddc15c5b45c000cd0266aed9dead Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Mon, 29 Jul 2024 21:26:17 -0400 Subject: window borders --- applications/goldman/makefile | 2 +- applications/goldman/source/renderer.cpp | 17 ++-- applications/goldman/source/renderer.hpp | 10 ++- applications/goldman/source/socket.cpp | 8 +- applications/goldman/source/window.cpp | 78 +++++++++++++++++ applications/goldman/source/window.hpp | 12 ++- applications/hello/source/main.cpp | 16 +++- euler/include/std/list.hpp | 5 ++ libraries/daguerre/include/daguerre/image.hpp | 7 ++ .../daguerre/include/daguerre/impl/fixed-font.hpp | 1 + libraries/daguerre/include/daguerre/impl/image.hpp | 20 ++++- libraries/pake/include/pake/widget.hpp | 8 ++ libraries/pake/include/pake/widgets/fixed-text.hpp | 5 +- libraries/pake/source/widgets/fixed-text.cpp | 42 +++++++-- readme.txt | 9 +- skeleton/assets/readme.txt | 4 - skeleton/assets/terminus-bold-18x10.psf | Bin 10741 -> 0 bytes skeleton/assets/terminus-ofl.txt | 94 --------------------- skeleton/assets/terminus/10x18-bold.psf | Bin 0 -> 10741 bytes skeleton/assets/terminus/6x12.psf | Bin 0 -> 3873 bytes skeleton/assets/terminus/readme.txt | 3 + skeleton/assets/terminus/terminus-ofl.txt | 94 +++++++++++++++++++++ 22 files changed, 306 insertions(+), 129 deletions(-) create mode 100644 applications/goldman/source/window.cpp delete mode 100644 skeleton/assets/terminus-bold-18x10.psf delete mode 100644 skeleton/assets/terminus-ofl.txt create mode 100644 skeleton/assets/terminus/10x18-bold.psf create mode 100644 skeleton/assets/terminus/6x12.psf create mode 100644 skeleton/assets/terminus/readme.txt create mode 100644 skeleton/assets/terminus/terminus-ofl.txt diff --git a/applications/goldman/makefile b/applications/goldman/makefile index c6de0e7..0d07717 100644 --- a/applications/goldman/makefile +++ b/applications/goldman/makefile @@ -1,5 +1,5 @@ SOURCES = \ - main.cpp renderer.cpp input.cpp socket.cpp + main.cpp renderer.cpp input.cpp socket.cpp window.cpp build/%.cpp.o: source/%.cpp @mkdir -p $(@D) diff --git a/applications/goldman/source/renderer.cpp b/applications/goldman/source/renderer.cpp index 629c375..7a5e6b5 100644 --- a/applications/goldman/source/renderer.cpp +++ b/applications/goldman/source/renderer.cpp @@ -52,9 +52,11 @@ void renderer::do_render() { for (auto it = windows.begin(); it != windows.end(); ++it) double_buffer.copy_from( - (*it)->contents, (*it)->x, (*it)->y, 0, 0, - std::min((*it)->contents.width, double_buffer.width - (*it)->x), - std::min((*it)->contents.height, double_buffer.height - (*it)->y)); + (*it)->contents_with_decorations, (*it)->x, (*it)->y, 0, 0, + std::min((*it)->contents_with_decorations.width, + double_buffer.width - (*it)->x), + std::min((*it)->contents_with_decorations.height, + double_buffer.height - (*it)->y)); double_buffer.convert_from( cursor_background, cursor, cursor_x, cursor_y, 0, 0, @@ -93,10 +95,15 @@ void renderer::bump_cursor(int x_offset, int y_offset) { } -void renderer::add_window(const window *w) { +void renderer::add_window(window *w) { + if (windows.size() != 0) + windows.back()->draw_decorations(false); + w->draw_decorations(true); windows.push_back(w); } -void renderer::remove_window(const window *w) { +void renderer::remove_window(window *w) { windows.remove(w); + if (windows.size() != 0) + windows.back()->draw_decorations(true); } diff --git a/applications/goldman/source/renderer.hpp b/applications/goldman/source/renderer.hpp index 14a5964..91afe88 100644 --- a/applications/goldman/source/renderer.hpp +++ b/applications/goldman/source/renderer.hpp @@ -18,7 +18,7 @@ class renderer { int cursor_y; //bottom to top - std::list windows; + std::list windows; std::mutex mut; @@ -55,7 +55,11 @@ public: void bump_cursor(int x_offset, int y_offset); - void add_window(const window *w); - void remove_window(const window *w); + void add_window(window *w); + void remove_window(window *w); + + inline bool is_top(window *w) { + return windows.size() != 0 && w == windows.back(); + } }; diff --git a/applications/goldman/source/socket.cpp b/applications/goldman/source/socket.cpp index 9ebd644..aa9b85e 100644 --- a/applications/goldman/source/socket.cpp +++ b/applications/goldman/source/socket.cpp @@ -43,12 +43,13 @@ struct socket_state { euler::syscall::stream_result::success) return false; - if (packet.width > __INT_MAX__ || packet.height > __INT_MAX__) + if (packet. width > __INT_MAX__ - window::decorations_extra_width || + packet.height > __INT_MAX__ - window::decorations_extra_height) return false; r->lock(); - w->contents = daguerre::image( - packet.width, packet.height); + w->set_size(packet.width, packet.height); + w->draw_decorations(r->is_top(w)); r->unlock(); return true; @@ -69,6 +70,7 @@ struct socket_state { r->lock(); w->title = std::move(title); + w->draw_decorations(r->is_top(w)); r->unlock(); r->dispatch_render(); return true; diff --git a/applications/goldman/source/window.cpp b/applications/goldman/source/window.cpp new file mode 100644 index 0000000..fe5212a --- /dev/null +++ b/applications/goldman/source/window.cpp @@ -0,0 +1,78 @@ +#include +#include "renderer.hpp" +#include "window.hpp" +#include + +//TODO: make these statically intialized once that is implemented +bool have_initialized_decoration_stuff; +daguerre::fixed_font *title_font; +daguerre::hilbert_color border_color_top; +daguerre::hilbert_color border_color_not_top; +daguerre::hilbert_color title_color; + +void window::set_size(int width, int height) { + contents_with_decorations = + daguerre::image(width + 4, height + 18); + contents = daguerre::image( + width, height, + &contents_with_decorations.at(2, 16), + contents_with_decorations.buffer_pitch, false); +} + +void title_converter( + daguerre::hilbert_color &out, const bool &in, const bool &top) { + out = in ? title_color : top ? border_color_top : border_color_not_top; +} + +void window::draw_decorations(bool top) { + + //TODO: handle error loading font. + //see also comment on title_font declaration. + if (!have_initialized_decoration_stuff) { + title_font = new daguerre::fixed_font( + *daguerre::try_load_psf("/assets/terminus/6x12.psf")); + assert(title_font->glyph_height == 12); + border_color_top = euler::syscall::encode_color(0x00, 0x3f, 0xff); + border_color_not_top = euler::syscall::encode_color(0x22, 0x22, 0x22); + title_color = euler::syscall::encode_color(0xff, 0xff, 0xff); + have_initialized_decoration_stuff = true; + } + + static_assert( decorations_extra_width == 4); + static_assert(decorations_extra_height == 18); + + auto border_color = top ? border_color_top : border_color_not_top; + + contents_with_decorations.fill(border_color, 0, 0, + contents_with_decorations.width, 16); + contents_with_decorations.fill( + border_color, 0, contents_with_decorations.height - 2, + contents_with_decorations.width, 2); + contents_with_decorations.fill(border_color, 0, 16, + 2, contents_with_decorations.height - 18); + contents_with_decorations.fill(border_color, + contents_with_decorations.width - 2, 16, + 2, contents_with_decorations.height - 18); + + //TODO: make UTF-8--safe + unsigned max_title_length = + contents_with_decorations.width / title_font->glyph_width; + std::string *title_to_draw; + std::string shortened_title; + if (title.size() > max_title_length) { + shortened_title.resize(max_title_length - 3); + memcpy(shortened_title.data(), title.data(), max_title_length - 3); + shortened_title[max_title_length - 3] = '.'; + shortened_title[max_title_length - 2] = '.'; + shortened_title[max_title_length - 1] = '.'; + title_to_draw = &shortened_title; + } + else + title_to_draw = &title; + + contents_with_decorations.render_text(*title_font, top, + contents_with_decorations.width / 2 - + (title_to_draw->size() * title_font->glyph_width) / 2, + 2, title_to_draw->data(), title_converter); + +} diff --git a/applications/goldman/source/window.hpp b/applications/goldman/source/window.hpp index 4d5b0e1..5c2d7a0 100644 --- a/applications/goldman/source/window.hpp +++ b/applications/goldman/source/window.hpp @@ -4,6 +4,10 @@ struct window { + static constexpr int decorations_extra_width = 4; + static constexpr int decorations_extra_height = 18; + + daguerre::image contents_with_decorations; daguerre::image contents; int x; @@ -13,6 +17,12 @@ struct window { std::string title; - window() : x(0), y(0), is_shown(false) {} + void set_size(int width, int height); + void draw_decorations(bool top); + + inline window() : x(0), y(0), is_shown(false) { + set_size(0, 0); + draw_decorations(false); + } }; diff --git a/applications/hello/source/main.cpp b/applications/hello/source/main.cpp index 1f45407..b297721 100644 --- a/applications/hello/source/main.cpp +++ b/applications/hello/source/main.cpp @@ -7,18 +7,30 @@ daguerre::fixed_font *font; int main(int, char **) { font = new daguerre::fixed_font( - daguerre::try_load_psf("/assets/terminus-bold-18x10.psf").value()); + daguerre::try_load_psf("/assets/terminus/10x18-bold.psf").value()); pake::widgets::fixed_text *text = new pake::widgets::fixed_text("Hello, world!", font, euler::syscall::encode_color(0xaa, 0xaa, 0xaa), - euler::syscall::encode_color(0x00, 0x00, 0x00)); + euler::syscall::encode_color(0x00, 0x00, 0x00), + pake::halign::center, pake::valign::center); pake::window w(300, 200, "Hello"); w.set_root(std::unique_ptr(text)); w.render_and_send_to_compositor(); w.show(); + pake::widgets::fixed_text *text2 = + new pake::widgets::fixed_text("H!", font, + euler::syscall::encode_color(0xaa, 0xaa, 0xaa), + euler::syscall::encode_color(0x00, 0x00, 0x00), + pake::halign::center, pake::valign::center); + + pake::window w2(100, 50, "Hello 2"); + w2.set_root(std::unique_ptr(text2)); + w2.render_and_send_to_compositor(); + w2.show(); + //TODO: call event loop euler::syscall::stream_handle h1, h2; diff --git a/euler/include/std/list.hpp b/euler/include/std/list.hpp index c0d6e21..030eccc 100644 --- a/euler/include/std/list.hpp +++ b/euler/include/std/list.hpp @@ -155,6 +155,11 @@ namespace std { return *this; } + T &back() { return last_node->value; } + const T &back() const { return last_node->value; } + + size_t size() const noexcept { return count; } + }; } diff --git a/libraries/daguerre/include/daguerre/image.hpp b/libraries/daguerre/include/daguerre/image.hpp index a55f43b..3c9c902 100644 --- a/libraries/daguerre/include/daguerre/image.hpp +++ b/libraries/daguerre/include/daguerre/image.hpp @@ -110,6 +110,13 @@ namespace daguerre { param_converter_t *conversion = &default_conversion); + //does not check bounds or wrap text + template + void render_text( + const fixed_font &font, int x, int y, const char *text, + converter_t *conversion = + &default_conversion); + }; template diff --git a/libraries/daguerre/include/daguerre/impl/fixed-font.hpp b/libraries/daguerre/include/daguerre/impl/fixed-font.hpp index 1a5f3d8..61a27fc 100644 --- a/libraries/daguerre/include/daguerre/impl/fixed-font.hpp +++ b/libraries/daguerre/include/daguerre/impl/fixed-font.hpp @@ -35,6 +35,7 @@ namespace daguerre { glyphs[i] = std::move(other.glyphs[i]); other.glyph_width = 0; other.glyph_height = 0; + return *this; } template diff --git a/libraries/daguerre/include/daguerre/impl/image.hpp b/libraries/daguerre/include/daguerre/impl/image.hpp index 6cf2ca9..c91cc7d 100644 --- a/libraries/daguerre/include/daguerre/impl/image.hpp +++ b/libraries/daguerre/include/daguerre/impl/image.hpp @@ -107,7 +107,7 @@ namespace daguerre { void image::fill( const color_t &color, int start_x, int start_y, int width, int height) { for (int y = start_y; y < start_y + height; ++y) - for (int x = 0; x < start_x + width; ++x) + for (int x = start_x; x < start_x + width; ++x) buffer[y * buffer_pitch + x] = color; } @@ -170,7 +170,7 @@ namespace daguerre { void image::convert_from( const image &other, int to_x, int to_y, converter_t *conversion) { - convert_from(other, to_x, to_y, 0, 0, other.width, other.y, conversion); + convert_from(other, to_x, to_y, 0, 0, other.width, other.height, conversion); } template @@ -213,6 +213,22 @@ namespace daguerre { } + template + template + void image::render_text( + const fixed_font &font, int x, int y, const char *text, + converter_t *conversion) { + + while (*text) { + int ch = *text; + if (ch >= 0 && ch < 128) + convert_from(font.glyphs[ch], x, y, conversion); + ++text; + x += font.glyph_width; + } + + } + template void swap(image &a, image &b) { std::swap(a.delete_buffer_on_destruct, b.delete_buffer_on_destruct); diff --git a/libraries/pake/include/pake/widget.hpp b/libraries/pake/include/pake/widget.hpp index dad5651..466fb80 100644 --- a/libraries/pake/include/pake/widget.hpp +++ b/libraries/pake/include/pake/widget.hpp @@ -4,6 +4,14 @@ namespace pake { + enum class halign { + left, center, right + }; + + enum class valign { + top, center, bottom + }; + class widget { public: diff --git a/libraries/pake/include/pake/widgets/fixed-text.hpp b/libraries/pake/include/pake/widgets/fixed-text.hpp index c6dafab..dc2e277 100644 --- a/libraries/pake/include/pake/widgets/fixed-text.hpp +++ b/libraries/pake/include/pake/widgets/fixed-text.hpp @@ -12,6 +12,8 @@ namespace pake::widgets { std::string text; int width, height; + halign ha; + valign va; public: //TODO: look up font in some kind of catalogue @@ -19,7 +21,8 @@ namespace pake::widgets { std::string &&text, const daguerre::fixed_font *font, daguerre::hilbert_color bg, - daguerre::hilbert_color fg); + daguerre::hilbert_color fg, + halign ha, valign va); virtual void render( dirtiable_image &onto, int x_off, int y_off, bool force) override; diff --git a/libraries/pake/source/widgets/fixed-text.cpp b/libraries/pake/source/widgets/fixed-text.cpp index 9ae55dc..c3a9a10 100644 --- a/libraries/pake/source/widgets/fixed-text.cpp +++ b/libraries/pake/source/widgets/fixed-text.cpp @@ -12,24 +12,48 @@ namespace pake::widgets { std::string &&text, const daguerre::fixed_font *font, daguerre::hilbert_color bg, - daguerre::hilbert_color fg) - : font(font), bg(bg), fg(fg), text(std::move(text)) {} + daguerre::hilbert_color fg, + halign ha, valign va) + : font(font), bg(bg), fg(fg), + text(std::move(text)), ha(ha), va(va) {} void fixed_text::render( dirtiable_image &onto, int x_off, int y_off, bool force) { if (force) { - onto.image.fill( bg, x_off, y_off, width, height); - onto.dirty.fill(true, x_off, y_off, width, height); - //TODO: have options for alignment + //TODO: check overflow + + onto.dirty.fill(true, x_off, y_off, width, height); + + onto.image.fill( bg, x_off, y_off, width, height); + + switch (ha) { + case halign::left: + break; + case halign::center: + x_off = width / 2 - text.size() * font->glyph_width / 2; + break; + case halign::right: + x_off = width - text.size() * font->glyph_width; + break; + } + + switch (va) { + case valign::top: + break; + case valign::center: + y_off = height / 2 - font->glyph_height / 2; + break; + case valign::bottom: + y_off = height - font->glyph_width; + break; + } + onto.image.render_text( *font, fg, x_off, y_off, text.data(), draw_if_true); - onto.dirty.fill( - true, x_off, y_off, - font->glyph_width * text.size(), - font->glyph_height); + } } diff --git a/readme.txt b/readme.txt index d1f2829..0cbd9a8 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,8 @@ makefile target builds a disk image at build/disk.iso that can be booted on a 64-bit bios system. you can use command [2] to build that. finally, use command [3] to run the disk in qemu with gdb attached. - [1] apt install bison flex g++ gdb git libgmp-dev libmpfr-dev libmpc-dev make nasm qemu-system-x86 texinfo xorriso + [1] apt install bison flex g++ gdb git libgmp-dev libmpfr-dev + libmpc-dev make nasm qemu-system-x86 texinfo xorriso [2] make -j$(nproc) [3] make run @@ -44,7 +45,7 @@ acknowledgements (any under "dependencies" are downloaded during build): license: https://unsplash.com/license source: https://unsplash.com/photos/selective-focus-photography-snowflakes-9yhy1FXlKwI - - skeleton/assets/terminus-bold-18x10.psf (terminus font, bold, 18x10) + - skeleton/assets/terminus/*.psf (terminus font) copyright 2020 dimitar toshkov zhekov license: skeleton/assets/terminus-ofl.txt (sil open font license v1.1) homepage: https://terminus-font.sourceforge.net/ @@ -87,8 +88,8 @@ project structure: - libraries/daguerre: an image loading / rendering library. - - libraries/goldman: - a library for interfacing with the goldman compositor + - libraries/pake: + a widget library for windowed applications - patches: a couple patches that are applied to dependencies diff --git a/skeleton/assets/readme.txt b/skeleton/assets/readme.txt index a9c6b1d..23bddbc 100644 --- a/skeleton/assets/readme.txt +++ b/skeleton/assets/readme.txt @@ -5,7 +5,3 @@ its license can be found online at https://unsplash.com/license. the icon in pointer.ppm is released under the cc0 1.0 universal public domain dedication (https://creativecommons.org/publicdomain/zero/1.0/). - -the font in terminus-bold-18x10.psf is the "terminus" font, in bold weight, at -18x10. it can be found only at https://terminus-font.sourceforge.net/ and is -under the license in terminus-ofl.txt (the sil open font license v1.1). diff --git a/skeleton/assets/terminus-bold-18x10.psf b/skeleton/assets/terminus-bold-18x10.psf deleted file mode 100644 index 6a7e29c..0000000 Binary files a/skeleton/assets/terminus-bold-18x10.psf and /dev/null differ diff --git a/skeleton/assets/terminus-ofl.txt b/skeleton/assets/terminus-ofl.txt deleted file mode 100644 index 5168372..0000000 --- a/skeleton/assets/terminus-ofl.txt +++ /dev/null @@ -1,94 +0,0 @@ -Copyright (C) 2020 Dimitar Toshkov Zhekov, -with Reserved Font Name "Terminus Font". - -This Font Software is licensed under the SIL Open Font License, Version 1.1. -This license is copied below, and is also available with a FAQ at: -http://scripts.sil.org/OFL - - ------------------------------------------------------------ -SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 ------------------------------------------------------------ - -PREAMBLE -The goals of the Open Font License (OFL) are to stimulate worldwide -development of collaborative font projects, to support the font creation -efforts of academic and linguistic communities, and to provide a free and -open framework in which fonts may be shared and improved in partnership -with others. - -The OFL allows the licensed fonts to be used, studied, modified and -redistributed freely as long as they are not sold by themselves. The -fonts, including any derivative works, can be bundled, embedded, -redistributed and/or sold with any software provided that any reserved -names are not used by derivative works. The fonts and derivatives, -however, cannot be released under any other type of license. The -requirement for fonts to remain under this license does not apply -to any document created using the fonts or their derivatives. - -DEFINITIONS -"Font Software" refers to the set of files released by the Copyright -Holder(s) under this license and clearly marked as such. This may -include source files, build scripts and documentation. - -"Reserved Font Name" refers to any names specified as such after the -copyright statement(s). - -"Original Version" refers to the collection of Font Software components as -distributed by the Copyright Holder(s). - -"Modified Version" refers to any derivative made by adding to, deleting, -or substituting -- in part or in whole -- any of the components of the -Original Version, by changing formats or by porting the Font Software to a -new environment. - -"Author" refers to any designer, engineer, programmer, technical -writer or other person who contributed to the Font Software. - -PERMISSION & CONDITIONS -Permission is hereby granted, free of charge, to any person obtaining -a copy of the Font Software, to use, study, copy, merge, embed, modify, -redistribute, and sell modified and unmodified copies of the Font -Software, subject to the following conditions: - -1) Neither the Font Software nor any of its individual components, -in Original or Modified Versions, may be sold by itself. - -2) Original or Modified Versions of the Font Software may be bundled, -redistributed and/or sold with any software, provided that each copy -contains the above copyright notice and this license. These can be -included either as stand-alone text files, human-readable headers or -in the appropriate machine-readable metadata fields within text or -binary files as long as those fields can be easily viewed by the user. - -3) No Modified Version of the Font Software may use the Reserved Font -Name(s) unless explicit written permission is granted by the corresponding -Copyright Holder. This restriction only applies to the primary font name as -presented to the users. - -4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font -Software shall not be used to promote, endorse or advertise any -Modified Version, except to acknowledge the contribution(s) of the -Copyright Holder(s) and the Author(s) or with their explicit written -permission. - -5) The Font Software, modified or unmodified, in part or in whole, -must be distributed entirely under this license, and must not be -distributed under any other license. The requirement for fonts to -remain under this license does not apply to any document created -using the Font Software. - -TERMINATION -This license becomes null and void if any of the above conditions are -not met. - -DISCLAIMER -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT -OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM -OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/skeleton/assets/terminus/10x18-bold.psf b/skeleton/assets/terminus/10x18-bold.psf new file mode 100644 index 0000000..6a7e29c Binary files /dev/null and b/skeleton/assets/terminus/10x18-bold.psf differ diff --git a/skeleton/assets/terminus/6x12.psf b/skeleton/assets/terminus/6x12.psf new file mode 100644 index 0000000..4f4be5a Binary files /dev/null and b/skeleton/assets/terminus/6x12.psf differ diff --git a/skeleton/assets/terminus/readme.txt b/skeleton/assets/terminus/readme.txt new file mode 100644 index 0000000..1941cec --- /dev/null +++ b/skeleton/assets/terminus/readme.txt @@ -0,0 +1,3 @@ +this directory contains the "terminus" font, at a couple weights and sizes. +terminus can be found only at https://terminus-font.sourceforge.net/ and is +under the license in terminus-ofl.txt (the sil open font license v1.1). diff --git a/skeleton/assets/terminus/terminus-ofl.txt b/skeleton/assets/terminus/terminus-ofl.txt new file mode 100644 index 0000000..5168372 --- /dev/null +++ b/skeleton/assets/terminus/terminus-ofl.txt @@ -0,0 +1,94 @@ +Copyright (C) 2020 Dimitar Toshkov Zhekov, +with Reserved Font Name "Terminus Font". + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. -- cgit v1.2.3