Быстрый и простой аддон упаковка шрифта.
«Сташ шрифта позволяет легко рендеринг строки в приложениях OpenGL. Он поддерживает шрифты TrueType и кодируемые UTF-8 локализованные строки. Все глифы кэшируются в атлазах текстуры OpenGL.
Основные особенности:
Я внес крошечные модификации Fontstash, чтобы рендерировать текст, перевернутый вертикально, чтобы играть лучше во вселенной OpenFrameWorks в целом. Он также будет сообщать каждый раз, когда создается новая текстура. Другие модификации были сделаны для поддержки MIPMAP, интерната персонажей, кернина и поддержки сетчатки.
OfxFontStash поддерживает основной однострочный текстовый чертеж, LineHeight, многослойный текстовый рендеринг на основе ' n', а также обертка слов, чтобы нарисовать абзац, ограниченный определенной шириной. Он также предлагает расчеты Bbox во всех вариантах чертежа. Это требует конкретной ветви OfxUnicode.
Я внес некоторые дальнейшие модификации в FontStash, чтобы позволить создавать MIPMAP, и для обеспечения использования информации о кернинге, определенной шрифтом, показано расстояние между парами символов.
OfxFontStash довольно быстрый при рисовании текста. Если вам нужно нарисовать текстовый столбец с определенной шириной с выравниванием левой части, OFXFontStash может быть ~ 10 раз быстрее, чем ofxftgl.
Шрифт был первоначально создан и опубликован Микко Мононеном.
Чтобы заставить это работать на Raspberry Pi, вам нужно переименовать "libs/fontstash/src/fontstash.c" и "libs/fontstash/src/stb_truetype.c" от *.c до *.cpp.
ofxfontstash.cpp и ofxfontstash.h были созданы Ориолом Феррером Месией и выпущены по лицензии MIT.
Copyright (c) 2012 Oriol Ferrer Mesià
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Файлы fontstash.c, fontstash.h и main.c лицензируются по лицензии Zlib:
Copyright (c) 2011 Andreas Krinke [email protected]
Copyright (c) 2009 Mikko Mononen [email protected]
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Для декодирования UTF-8, Font Stash использует гибкий и экономичный декодер UTF-8 Бьорн Херманн (включенный в Fontstash.c). Его код лицензирован по лицензии MIT:
Copyright (c) 2008-2009 Bjoern Hoehrmann <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Наконец, Font Stash использует общественный домен Шона Барретта TrueType Font Rasterizer STB_TRUETYPE.H.