/* Copyright (c) 2023 Alex Diener 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. Alex Diener alex@ludobloom.com */ #ifndef __UITypeface_BitmapFont2_H__ #define __UITypeface_BitmapFont2_H__ typedef struct UITypeface_BitmapFont2 UITypeface_BitmapFont2; #define UITypeface_BitmapFont2_superclass UITypeface #include "font/BitmapFont2.h" #include "uitoolkit/UITypeface.h" #define UITypeface_BitmapFont2_ivars \ UITypeface_ivars \ \ BitmapFont2 * font; \ float scale; \ int spacingAdjustment; \ BitmapFont_drawOptions drawOptions; #define UITypeface_BitmapFont2_vtable(self_type) \ UITypeface_vtable(self_type) stemobject_declare(UITypeface_BitmapFont2) UITypeface_BitmapFont2 * UITypeface_BitmapFont2_create(BitmapFont2 * font, float scale, int spacingAdjustment, BitmapFont_drawOptions drawOptions); bool UITypeface_BitmapFont2_init(UITypeface_BitmapFont2 * self, BitmapFont2 * font, float scale, int spacingAdjustment, BitmapFont_drawOptions drawOptions); void UITypeface_BitmapFont2_dispose(UITypeface_BitmapFont2 * self); float UITypeface_BitmapFont2_getLineHeight(UITypeface_BitmapFont2 * self); float UITypeface_BitmapFont2_measureString(UITypeface_BitmapFont2 * self, String string); float UITypeface_BitmapFont2_positionXAtIndex(UITypeface_BitmapFont2 * self, String string, size_t index); size_t UITypeface_BitmapFont2_indexAtPositionX(UITypeface_BitmapFont2 * self, String string, float positionX, bool * outLeadingEdge); void UITypeface_BitmapFont2_writeGlyphsWithCallback(UITypeface_BitmapFont2 * self, String string, Vector2f offset, float scale, UITypeface_glyphCallback callback, void * callbackContext); uint32_t UITypeface_BitmapFont2_characterIndexToCodepoint(UITypeface_BitmapFont2 * self, unsigned int characterIndex); unsigned int UITypeface_BitmapFont2_codepointToCharacterIndex(UITypeface_BitmapFont2 * self, uint32_t codepoint); String UITypeface_BitmapFont2_encodeCharacterIndexString(UITypeface_BitmapFont2 * self, String string); String UITypeface_BitmapFont2_decodeCharacterIndexString(UITypeface_BitmapFont2 * self, String string, TextEncoding encoding); #endif