/* 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_BitmapFont_H__ #define __UITypeface_BitmapFont_H__ typedef struct UITypeface_BitmapFont UITypeface_BitmapFont; #define UITypeface_BitmapFont_superclass UITypeface #include "font/BitmapFont.h" #include "uitoolkit/UITypeface.h" #define UITypeface_BitmapFont_ivars \ UITypeface_ivars \ \ BitmapFont * font; \ BitmapFont_drawOptions drawOptions; #define UITypeface_BitmapFont_vtable(self_type) \ UITypeface_vtable(self_type) stemobject_declare(UITypeface_BitmapFont) UITypeface_BitmapFont * UITypeface_BitmapFont_create(BitmapFont * font, BitmapFont_drawOptions drawOptions); bool UITypeface_BitmapFont_init(UITypeface_BitmapFont * self, BitmapFont * font, BitmapFont_drawOptions drawOptions); void UITypeface_BitmapFont_dispose(UITypeface_BitmapFont * self); float UITypeface_BitmapFont_getLineHeight(UITypeface_BitmapFont * self); float UITypeface_BitmapFont_measureString(UITypeface_BitmapFont * self, String string); float UITypeface_BitmapFont_positionXAtIndex(UITypeface_BitmapFont * self, String string, size_t index); size_t UITypeface_BitmapFont_indexAtPositionX(UITypeface_BitmapFont * self, String string, float positionX, bool * outLeadingEdge); void UITypeface_BitmapFont_writeGlyphsWithCallback(UITypeface_BitmapFont * self, String string, Vector2f offset, float scale, UITypeface_glyphCallback callback, void * callbackContext); uint32_t UITypeface_BitmapFont_characterIndexToCodepoint(UITypeface_BitmapFont * self, unsigned int characterIndex); unsigned int UITypeface_BitmapFont_codepointToCharacterIndex(UITypeface_BitmapFont * self, uint32_t codepoint); #endif