├── .gitignore ├── LICENSE ├── README.md ├── examples ├── inc │ ├── GLFW │ │ ├── glfw3.h │ │ └── glfw3native.h │ ├── freetype2 │ │ ├── freetype │ │ │ ├── config │ │ │ │ ├── ftconfig.h │ │ │ │ ├── ftheader.h │ │ │ │ ├── ftmodule.h │ │ │ │ ├── ftoption.h │ │ │ │ ├── ftstdlib.h │ │ │ │ ├── integer-types.h │ │ │ │ ├── mac-support.h │ │ │ │ └── public-macros.h │ │ │ ├── freetype.h │ │ │ ├── ftadvanc.h │ │ │ ├── ftbbox.h │ │ │ ├── ftbdf.h │ │ │ ├── ftbitmap.h │ │ │ ├── ftbzip2.h │ │ │ ├── ftcache.h │ │ │ ├── ftchapters.h │ │ │ ├── ftcid.h │ │ │ ├── ftcolor.h │ │ │ ├── ftdriver.h │ │ │ ├── fterrdef.h │ │ │ ├── fterrors.h │ │ │ ├── ftfntfmt.h │ │ │ ├── ftgasp.h │ │ │ ├── ftglyph.h │ │ │ ├── ftgxval.h │ │ │ ├── ftgzip.h │ │ │ ├── ftimage.h │ │ │ ├── ftincrem.h │ │ │ ├── ftlcdfil.h │ │ │ ├── ftlist.h │ │ │ ├── ftlogging.h │ │ │ ├── ftlzw.h │ │ │ ├── ftmac.h │ │ │ ├── ftmm.h │ │ │ ├── ftmodapi.h │ │ │ ├── ftmoderr.h │ │ │ ├── ftotval.h │ │ │ ├── ftoutln.h │ │ │ ├── ftparams.h │ │ │ ├── ftpfr.h │ │ │ ├── ftrender.h │ │ │ ├── ftsizes.h │ │ │ ├── ftsnames.h │ │ │ ├── ftstroke.h │ │ │ ├── ftsynth.h │ │ │ ├── ftsystem.h │ │ │ ├── fttrigon.h │ │ │ ├── fttypes.h │ │ │ ├── ftwinfnt.h │ │ │ ├── otsvg.h │ │ │ ├── t1tables.h │ │ │ ├── ttnameid.h │ │ │ ├── tttables.h │ │ │ └── tttags.h │ │ └── ft2build.h │ └── imgui │ │ ├── imconfig.h │ │ ├── imgui.h │ │ ├── imgui_impl_glfw.h │ │ ├── imgui_impl_opengl3.h │ │ ├── imgui_impl_opengl3_loader.h │ │ ├── imgui_internal.h │ │ ├── imstb_rectpack.h │ │ ├── imstb_textedit.h │ │ ├── imstb_truetype.h │ │ └── misc │ │ └── freetype │ │ ├── imgui_freetype.cpp │ │ └── imgui_freetype.h ├── lib │ ├── blend2d.lib │ ├── freetype.lib │ └── glfw3_mt.lib ├── src │ ├── imgui.cpp │ ├── imgui_demo.cpp │ ├── imgui_draw.cpp │ ├── imgui_impl_glfw.cpp │ ├── imgui_impl_opengl3.cpp │ ├── imgui_tables.cpp │ └── imgui_widgets.cpp └── win32 │ └── imrichtext_demo │ ├── glfwgl3 │ ├── imrichtext_demo.cpp │ ├── imrichtext_demo.vcxproj │ ├── imrichtext_demo.vcxproj.filters │ └── imrichtext_demo.vcxproj.user │ └── imrichtext_demo.sln ├── imrichtext.cpp ├── imrichtext.h ├── imrichtextfont.cpp ├── imrichtextfont.h ├── imrichtextimpl.cpp ├── imrichtextimpl.h ├── imrichtextutils.cpp ├── imrichtextutils.h └── screenshots ├── basic.png └── imrichtext.gif /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Fortran module files 15 | *.mod 16 | *.smod 17 | 18 | # Executables 19 | *.exe 20 | *.out 21 | *.app 22 | 23 | # Editor Files 24 | *.db* 25 | *.ipch 26 | *.vsidx 27 | *.json 28 | *.suo 29 | *.tlog 30 | *.ilk 31 | *.log 32 | *.ini 33 | *.pdb 34 | *.idb 35 | *.recipe 36 | *.enc 37 | *.opendb 38 | *.iobj 39 | *.ipdb 40 | 41 | examples/win32/ImRichTe.*/ 42 | /examples/win32/imrichtext_demo/.vs/imrichtext_demo/copilot-chat 43 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Akash Pradhan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/config/ftconfig.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ftconfig.h 4 | * 5 | * ANSI-specific configuration file (specification only). 6 | * 7 | * Copyright (C) 1996-2024 by 8 | * David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | 19 | /************************************************************************** 20 | * 21 | * This header file contains a number of macro definitions that are used by 22 | * the rest of the engine. Most of the macros here are automatically 23 | * determined at compile time, and you should not need to change it to port 24 | * FreeType, except to compile the library with a non-ANSI compiler. 25 | * 26 | * Note however that if some specific modifications are needed, we advise 27 | * you to place a modified copy in your build directory. 28 | * 29 | * The build directory is usually `builds/`, and contains 30 | * system-specific files that are always included first when building the 31 | * library. 32 | * 33 | * This ANSI version should stay in `include/config/`. 34 | * 35 | */ 36 | 37 | #ifndef FTCONFIG_H_ 38 | #define FTCONFIG_H_ 39 | 40 | #include 41 | #include FT_CONFIG_OPTIONS_H 42 | #include FT_CONFIG_STANDARD_LIBRARY_H 43 | 44 | #include 45 | #include 46 | #include 47 | 48 | #endif /* FTCONFIG_H_ */ 49 | 50 | 51 | /* END */ 52 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/config/ftmodule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file registers the FreeType modules compiled into the library. 3 | * 4 | * If you use GNU make, this file IS NOT USED! Instead, it is created in 5 | * the objects directory (normally `/objs/`) based on information 6 | * from `/modules.cfg`. 7 | * 8 | * Please read `docs/INSTALL.ANY` and `docs/CUSTOMIZE` how to compile 9 | * FreeType without GNU make. 10 | * 11 | */ 12 | 13 | FT_USE_MODULE( FT_Module_Class, autofit_module_class ) 14 | FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class ) 15 | FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class ) 16 | FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class ) 17 | FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class ) 18 | FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class ) 19 | FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class ) 20 | FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class ) 21 | FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class ) 22 | FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class ) 23 | FT_USE_MODULE( FT_Module_Class, psaux_module_class ) 24 | FT_USE_MODULE( FT_Module_Class, psnames_module_class ) 25 | FT_USE_MODULE( FT_Module_Class, pshinter_module_class ) 26 | FT_USE_MODULE( FT_Module_Class, sfnt_module_class ) 27 | FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class ) 28 | FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class ) 29 | FT_USE_MODULE( FT_Renderer_Class, ft_sdf_renderer_class ) 30 | FT_USE_MODULE( FT_Renderer_Class, ft_bitmap_sdf_renderer_class ) 31 | FT_USE_MODULE( FT_Renderer_Class, ft_svg_renderer_class ) 32 | 33 | /* EOF */ 34 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/config/ftstdlib.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ftstdlib.h 4 | * 5 | * ANSI-specific library and header configuration file (specification 6 | * only). 7 | * 8 | * Copyright (C) 2002-2024 by 9 | * David Turner, Robert Wilhelm, and Werner Lemberg. 10 | * 11 | * This file is part of the FreeType project, and may only be used, 12 | * modified, and distributed under the terms of the FreeType project 13 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 14 | * this file you indicate that you have read the license and 15 | * understand and accept it fully. 16 | * 17 | */ 18 | 19 | 20 | /************************************************************************** 21 | * 22 | * This file is used to group all `#includes` to the ANSI~C library that 23 | * FreeType normally requires. It also defines macros to rename the 24 | * standard functions within the FreeType source code. 25 | * 26 | * Load a file which defines `FTSTDLIB_H_` before this one to override it. 27 | * 28 | */ 29 | 30 | 31 | #ifndef FTSTDLIB_H_ 32 | #define FTSTDLIB_H_ 33 | 34 | 35 | #include 36 | 37 | #define ft_ptrdiff_t ptrdiff_t 38 | 39 | 40 | /************************************************************************** 41 | * 42 | * integer limits 43 | * 44 | * `UINT_MAX` and `ULONG_MAX` are used to automatically compute the size of 45 | * `int` and `long` in bytes at compile-time. So far, this works for all 46 | * platforms the library has been tested on. We also check `ULLONG_MAX` 47 | * to see whether we can use 64-bit `long long` later on. 48 | * 49 | * Note that on the extremely rare platforms that do not provide integer 50 | * types that are _exactly_ 16 and 32~bits wide (e.g., some old Crays where 51 | * `int` is 36~bits), we do not make any guarantee about the correct 52 | * behaviour of FreeType~2 with all fonts. 53 | * 54 | * In these cases, `ftconfig.h` will refuse to compile anyway with a 55 | * message like 'couldn't find 32-bit type' or something similar. 56 | * 57 | */ 58 | 59 | 60 | #include 61 | 62 | #define FT_CHAR_BIT CHAR_BIT 63 | #define FT_USHORT_MAX USHRT_MAX 64 | #define FT_INT_MAX INT_MAX 65 | #define FT_INT_MIN INT_MIN 66 | #define FT_UINT_MAX UINT_MAX 67 | #define FT_LONG_MIN LONG_MIN 68 | #define FT_LONG_MAX LONG_MAX 69 | #define FT_ULONG_MAX ULONG_MAX 70 | #ifdef LLONG_MAX 71 | #define FT_LLONG_MAX LLONG_MAX 72 | #endif 73 | #ifdef LLONG_MIN 74 | #define FT_LLONG_MIN LLONG_MIN 75 | #endif 76 | #ifdef ULLONG_MAX 77 | #define FT_ULLONG_MAX ULLONG_MAX 78 | #endif 79 | 80 | 81 | /************************************************************************** 82 | * 83 | * character and string processing 84 | * 85 | */ 86 | 87 | 88 | #include 89 | 90 | #define ft_memchr memchr 91 | #define ft_memcmp memcmp 92 | #define ft_memcpy memcpy 93 | #define ft_memmove memmove 94 | #define ft_memset memset 95 | #define ft_strcat strcat 96 | #define ft_strcmp strcmp 97 | #define ft_strcpy strcpy 98 | #define ft_strlen strlen 99 | #define ft_strncmp strncmp 100 | #define ft_strncpy strncpy 101 | #define ft_strrchr strrchr 102 | #define ft_strstr strstr 103 | 104 | 105 | /************************************************************************** 106 | * 107 | * file handling 108 | * 109 | */ 110 | 111 | 112 | #include 113 | 114 | #define FT_FILE FILE 115 | #define ft_fclose fclose 116 | #define ft_fopen fopen 117 | #define ft_fread fread 118 | #define ft_fseek fseek 119 | #define ft_ftell ftell 120 | #define ft_snprintf snprintf 121 | 122 | 123 | /************************************************************************** 124 | * 125 | * sorting 126 | * 127 | */ 128 | 129 | 130 | #include 131 | 132 | #define ft_qsort qsort 133 | 134 | 135 | /************************************************************************** 136 | * 137 | * memory allocation 138 | * 139 | */ 140 | 141 | 142 | #define ft_scalloc calloc 143 | #define ft_sfree free 144 | #define ft_smalloc malloc 145 | #define ft_srealloc realloc 146 | 147 | 148 | /************************************************************************** 149 | * 150 | * miscellaneous 151 | * 152 | */ 153 | 154 | 155 | #define ft_strtol strtol 156 | #define ft_getenv getenv 157 | 158 | 159 | /************************************************************************** 160 | * 161 | * execution control 162 | * 163 | */ 164 | 165 | 166 | #include 167 | 168 | #define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */ 169 | /* `jmp_buf` is defined as a macro */ 170 | /* on certain platforms */ 171 | 172 | #define ft_longjmp longjmp 173 | #define ft_setjmp( b ) setjmp( *(ft_jmp_buf*) &(b) ) /* same thing here */ 174 | 175 | 176 | /* The following is only used for debugging purposes, i.e., if */ 177 | /* `FT_DEBUG_LEVEL_ERROR` or `FT_DEBUG_LEVEL_TRACE` are defined. */ 178 | 179 | #include 180 | 181 | 182 | #endif /* FTSTDLIB_H_ */ 183 | 184 | 185 | /* END */ 186 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/config/integer-types.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * config/integer-types.h 4 | * 5 | * FreeType integer types definitions. 6 | * 7 | * Copyright (C) 1996-2024 by 8 | * David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | #ifndef FREETYPE_CONFIG_INTEGER_TYPES_H_ 18 | #define FREETYPE_CONFIG_INTEGER_TYPES_H_ 19 | 20 | /* There are systems (like the Texas Instruments 'C54x) where a `char` */ 21 | /* has 16~bits. ANSI~C says that `sizeof(char)` is always~1. Since an */ 22 | /* `int` has 16~bits also for this system, `sizeof(int)` gives~1 which */ 23 | /* is probably unexpected. */ 24 | /* */ 25 | /* `CHAR_BIT` (defined in `limits.h`) gives the number of bits in a */ 26 | /* `char` type. */ 27 | 28 | #ifndef FT_CHAR_BIT 29 | #define FT_CHAR_BIT CHAR_BIT 30 | #endif 31 | 32 | #ifndef FT_SIZEOF_INT 33 | 34 | /* The size of an `int` type. */ 35 | #if FT_UINT_MAX == 0xFFFFUL 36 | #define FT_SIZEOF_INT ( 16 / FT_CHAR_BIT ) 37 | #elif FT_UINT_MAX == 0xFFFFFFFFUL 38 | #define FT_SIZEOF_INT ( 32 / FT_CHAR_BIT ) 39 | #elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL 40 | #define FT_SIZEOF_INT ( 64 / FT_CHAR_BIT ) 41 | #else 42 | #error "Unsupported size of `int' type!" 43 | #endif 44 | 45 | #endif /* !defined(FT_SIZEOF_INT) */ 46 | 47 | #ifndef FT_SIZEOF_LONG 48 | 49 | /* The size of a `long` type. A five-byte `long` (as used e.g. on the */ 50 | /* DM642) is recognized but avoided. */ 51 | #if FT_ULONG_MAX == 0xFFFFFFFFUL 52 | #define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT ) 53 | #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL 54 | #define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT ) 55 | #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL 56 | #define FT_SIZEOF_LONG ( 64 / FT_CHAR_BIT ) 57 | #else 58 | #error "Unsupported size of `long' type!" 59 | #endif 60 | 61 | #endif /* !defined(FT_SIZEOF_LONG) */ 62 | 63 | #ifndef FT_SIZEOF_LONG_LONG 64 | 65 | /* The size of a `long long` type if available */ 66 | #if defined( FT_ULLONG_MAX ) && FT_ULLONG_MAX >= 0xFFFFFFFFFFFFFFFFULL 67 | #define FT_SIZEOF_LONG_LONG ( 64 / FT_CHAR_BIT ) 68 | #else 69 | #define FT_SIZEOF_LONG_LONG 0 70 | #endif 71 | 72 | #endif /* !defined(FT_SIZEOF_LONG_LONG) */ 73 | 74 | 75 | /************************************************************************** 76 | * 77 | * @section: 78 | * basic_types 79 | * 80 | */ 81 | 82 | 83 | /************************************************************************** 84 | * 85 | * @type: 86 | * FT_Int16 87 | * 88 | * @description: 89 | * A typedef for a 16bit signed integer type. 90 | */ 91 | typedef signed short FT_Int16; 92 | 93 | 94 | /************************************************************************** 95 | * 96 | * @type: 97 | * FT_UInt16 98 | * 99 | * @description: 100 | * A typedef for a 16bit unsigned integer type. 101 | */ 102 | typedef unsigned short FT_UInt16; 103 | 104 | /* */ 105 | 106 | 107 | /* this #if 0 ... #endif clause is for documentation purposes */ 108 | #if 0 109 | 110 | /************************************************************************** 111 | * 112 | * @type: 113 | * FT_Int32 114 | * 115 | * @description: 116 | * A typedef for a 32bit signed integer type. The size depends on the 117 | * configuration. 118 | */ 119 | typedef signed XXX FT_Int32; 120 | 121 | 122 | /************************************************************************** 123 | * 124 | * @type: 125 | * FT_UInt32 126 | * 127 | * A typedef for a 32bit unsigned integer type. The size depends on the 128 | * configuration. 129 | */ 130 | typedef unsigned XXX FT_UInt32; 131 | 132 | 133 | /************************************************************************** 134 | * 135 | * @type: 136 | * FT_Int64 137 | * 138 | * A typedef for a 64bit signed integer type. The size depends on the 139 | * configuration. Only defined if there is real 64bit support; 140 | * otherwise, it gets emulated with a structure (if necessary). 141 | */ 142 | typedef signed XXX FT_Int64; 143 | 144 | 145 | /************************************************************************** 146 | * 147 | * @type: 148 | * FT_UInt64 149 | * 150 | * A typedef for a 64bit unsigned integer type. The size depends on the 151 | * configuration. Only defined if there is real 64bit support; 152 | * otherwise, it gets emulated with a structure (if necessary). 153 | */ 154 | typedef unsigned XXX FT_UInt64; 155 | 156 | /* */ 157 | 158 | #endif 159 | 160 | #if FT_SIZEOF_INT == ( 32 / FT_CHAR_BIT ) 161 | 162 | typedef signed int FT_Int32; 163 | typedef unsigned int FT_UInt32; 164 | 165 | #elif FT_SIZEOF_LONG == ( 32 / FT_CHAR_BIT ) 166 | 167 | typedef signed long FT_Int32; 168 | typedef unsigned long FT_UInt32; 169 | 170 | #else 171 | #error "no 32bit type found -- please check your configuration files" 172 | #endif 173 | 174 | 175 | /* look up an integer type that is at least 32~bits */ 176 | #if FT_SIZEOF_INT >= ( 32 / FT_CHAR_BIT ) 177 | 178 | typedef int FT_Fast; 179 | typedef unsigned int FT_UFast; 180 | 181 | #elif FT_SIZEOF_LONG >= ( 32 / FT_CHAR_BIT ) 182 | 183 | typedef long FT_Fast; 184 | typedef unsigned long FT_UFast; 185 | 186 | #endif 187 | 188 | 189 | /* determine whether we have a 64-bit integer type */ 190 | #if FT_SIZEOF_LONG == ( 64 / FT_CHAR_BIT ) 191 | 192 | #define FT_INT64 long 193 | #define FT_UINT64 unsigned long 194 | 195 | #elif FT_SIZEOF_LONG_LONG >= ( 64 / FT_CHAR_BIT ) 196 | 197 | #define FT_INT64 long long int 198 | #define FT_UINT64 unsigned long long int 199 | 200 | /************************************************************************** 201 | * 202 | * A 64-bit data type may create compilation problems if you compile in 203 | * strict ANSI mode. To avoid them, we disable other 64-bit data types if 204 | * `__STDC__` is defined. You can however ignore this rule by defining the 205 | * `FT_CONFIG_OPTION_FORCE_INT64` configuration macro. 206 | */ 207 | #elif !defined( __STDC__ ) || defined( FT_CONFIG_OPTION_FORCE_INT64 ) 208 | 209 | #if defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */ 210 | 211 | /* this compiler provides the `__int64` type */ 212 | #define FT_INT64 __int64 213 | #define FT_UINT64 unsigned __int64 214 | 215 | #elif defined( __BORLANDC__ ) /* Borland C++ */ 216 | 217 | /* XXXX: We should probably check the value of `__BORLANDC__` in order */ 218 | /* to test the compiler version. */ 219 | 220 | /* this compiler provides the `__int64` type */ 221 | #define FT_INT64 __int64 222 | #define FT_UINT64 unsigned __int64 223 | 224 | #elif defined( __WATCOMC__ ) && __WATCOMC__ >= 1100 /* Watcom C++ */ 225 | 226 | #define FT_INT64 long long int 227 | #define FT_UINT64 unsigned long long int 228 | 229 | #elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */ 230 | 231 | #define FT_INT64 long long int 232 | #define FT_UINT64 unsigned long long int 233 | 234 | #elif defined( __GNUC__ ) 235 | 236 | /* GCC provides the `long long` type */ 237 | #define FT_INT64 long long int 238 | #define FT_UINT64 unsigned long long int 239 | 240 | #endif /* !__STDC__ */ 241 | 242 | #endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */ 243 | 244 | #ifdef FT_INT64 245 | typedef FT_INT64 FT_Int64; 246 | typedef FT_UINT64 FT_UInt64; 247 | #endif 248 | 249 | 250 | #endif /* FREETYPE_CONFIG_INTEGER_TYPES_H_ */ 251 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/config/mac-support.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * config/mac-support.h 4 | * 5 | * Mac/OS X support configuration header. 6 | * 7 | * Copyright (C) 1996-2024 by 8 | * David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | #ifndef FREETYPE_CONFIG_MAC_SUPPORT_H_ 18 | #define FREETYPE_CONFIG_MAC_SUPPORT_H_ 19 | 20 | /************************************************************************** 21 | * 22 | * Mac support 23 | * 24 | * This is the only necessary change, so it is defined here instead 25 | * providing a new configuration file. 26 | */ 27 | #if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) ) 28 | /* No Carbon frameworks for 64bit 10.4.x. */ 29 | /* `AvailabilityMacros.h` is available since Mac OS X 10.2, */ 30 | /* so guess the system version by maximum errno before inclusion. */ 31 | #include 32 | #ifdef ECANCELED /* defined since 10.2 */ 33 | #include "AvailabilityMacros.h" 34 | #endif 35 | #if defined( __LP64__ ) && \ 36 | ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 ) 37 | #undef FT_MACINTOSH 38 | #endif 39 | 40 | #elif defined( __SC__ ) || defined( __MRC__ ) 41 | /* Classic MacOS compilers */ 42 | #include "ConditionalMacros.h" 43 | #if TARGET_OS_MAC 44 | #define FT_MACINTOSH 1 45 | #endif 46 | 47 | #endif /* Mac support */ 48 | 49 | #endif /* FREETYPE_CONFIG_MAC_SUPPORT_H_ */ 50 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/config/public-macros.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * config/public-macros.h 4 | * 5 | * Define a set of compiler macros used in public FreeType headers. 6 | * 7 | * Copyright (C) 2020-2024 by 8 | * David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | /* 19 | * The definitions in this file are used by the public FreeType headers 20 | * and thus should be considered part of the public API. 21 | * 22 | * Other compiler-specific macro definitions that are not exposed by the 23 | * FreeType API should go into 24 | * `include/freetype/internal/compiler-macros.h` instead. 25 | */ 26 | #ifndef FREETYPE_CONFIG_PUBLIC_MACROS_H_ 27 | #define FREETYPE_CONFIG_PUBLIC_MACROS_H_ 28 | 29 | /* 30 | * `FT_BEGIN_HEADER` and `FT_END_HEADER` might have already been defined 31 | * by `freetype/config/ftheader.h`, but we don't want to include this 32 | * header here, so redefine the macros here only when needed. Their 33 | * definition is very stable, so keeping them in sync with the ones in the 34 | * header should not be a maintenance issue. 35 | */ 36 | #ifndef FT_BEGIN_HEADER 37 | #ifdef __cplusplus 38 | #define FT_BEGIN_HEADER extern "C" { 39 | #else 40 | #define FT_BEGIN_HEADER /* empty */ 41 | #endif 42 | #endif /* FT_BEGIN_HEADER */ 43 | 44 | #ifndef FT_END_HEADER 45 | #ifdef __cplusplus 46 | #define FT_END_HEADER } 47 | #else 48 | #define FT_END_HEADER /* empty */ 49 | #endif 50 | #endif /* FT_END_HEADER */ 51 | 52 | 53 | FT_BEGIN_HEADER 54 | 55 | /* 56 | * Mark a function declaration as public. This ensures it will be 57 | * properly exported to client code. Place this before a function 58 | * declaration. 59 | * 60 | * NOTE: This macro should be considered an internal implementation 61 | * detail, and not part of the FreeType API. It is only defined here 62 | * because it is needed by `FT_EXPORT`. 63 | */ 64 | 65 | /* Visual C, mingw */ 66 | #if defined( _WIN32 ) 67 | 68 | #if defined( FT2_BUILD_LIBRARY ) && defined( DLL_EXPORT ) 69 | #define FT_PUBLIC_FUNCTION_ATTRIBUTE __declspec( dllexport ) 70 | #elif defined( DLL_IMPORT ) 71 | #define FT_PUBLIC_FUNCTION_ATTRIBUTE __declspec( dllimport ) 72 | #endif 73 | 74 | /* gcc, clang */ 75 | #elif ( defined( __GNUC__ ) && __GNUC__ >= 4 ) || defined( __clang__ ) 76 | #define FT_PUBLIC_FUNCTION_ATTRIBUTE \ 77 | __attribute__(( visibility( "default" ) )) 78 | 79 | /* Sun */ 80 | #elif defined( __SUNPRO_C ) && __SUNPRO_C >= 0x550 81 | #define FT_PUBLIC_FUNCTION_ATTRIBUTE __global 82 | #endif 83 | 84 | 85 | #ifndef FT_PUBLIC_FUNCTION_ATTRIBUTE 86 | #define FT_PUBLIC_FUNCTION_ATTRIBUTE /* empty */ 87 | #endif 88 | 89 | 90 | /* 91 | * Define a public FreeType API function. This ensures it is properly 92 | * exported or imported at build time. The macro parameter is the 93 | * function's return type as in: 94 | * 95 | * FT_EXPORT( FT_Bool ) 96 | * FT_Object_Method( FT_Object obj, 97 | * ... ); 98 | * 99 | * NOTE: This requires that all `FT_EXPORT` uses are inside 100 | * `FT_BEGIN_HEADER ... FT_END_HEADER` blocks. This guarantees that the 101 | * functions are exported with C linkage, even when the header is included 102 | * by a C++ source file. 103 | */ 104 | #define FT_EXPORT( x ) FT_PUBLIC_FUNCTION_ATTRIBUTE extern x 105 | 106 | 107 | /* 108 | * `FT_UNUSED` indicates that a given parameter is not used -- this is 109 | * only used to get rid of unpleasant compiler warnings. 110 | * 111 | * Technically, this was not meant to be part of the public API, but some 112 | * third-party code depends on it. 113 | */ 114 | #ifndef FT_UNUSED 115 | #define FT_UNUSED( arg ) ( (arg) = (arg) ) 116 | #endif 117 | 118 | 119 | /* 120 | * Support for casts in both C and C++. 121 | */ 122 | #ifdef __cplusplus 123 | #define FT_STATIC_CAST( type, var ) static_cast(var) 124 | #define FT_REINTERPRET_CAST( type, var ) reinterpret_cast(var) 125 | 126 | #define FT_STATIC_BYTE_CAST( type, var ) \ 127 | static_cast( static_cast( var ) ) 128 | #else 129 | #define FT_STATIC_CAST( type, var ) (type)(var) 130 | #define FT_REINTERPRET_CAST( type, var ) (type)(var) 131 | 132 | #define FT_STATIC_BYTE_CAST( type, var ) (type)(unsigned char)(var) 133 | #endif 134 | 135 | 136 | FT_END_HEADER 137 | 138 | #endif /* FREETYPE_CONFIG_PUBLIC_MACROS_H_ */ 139 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/ftadvanc.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ftadvanc.h 4 | * 5 | * Quick computation of advance widths (specification only). 6 | * 7 | * Copyright (C) 2008-2024 by 8 | * David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | 19 | #ifndef FTADVANC_H_ 20 | #define FTADVANC_H_ 21 | 22 | 23 | #include 24 | 25 | #ifdef FREETYPE_H 26 | #error "freetype.h of FreeType 1 has been loaded!" 27 | #error "Please fix the directory search order for header files" 28 | #error "so that freetype.h of FreeType 2 is found first." 29 | #endif 30 | 31 | 32 | FT_BEGIN_HEADER 33 | 34 | 35 | /************************************************************************** 36 | * 37 | * @section: 38 | * quick_advance 39 | * 40 | * @title: 41 | * Quick retrieval of advance values 42 | * 43 | * @abstract: 44 | * Retrieve horizontal and vertical advance values without processing 45 | * glyph outlines, if possible. 46 | * 47 | * @description: 48 | * This section contains functions to quickly extract advance values 49 | * without handling glyph outlines, if possible. 50 | * 51 | * @order: 52 | * FT_Get_Advance 53 | * FT_Get_Advances 54 | * 55 | */ 56 | 57 | 58 | /************************************************************************** 59 | * 60 | * @enum: 61 | * FT_ADVANCE_FLAG_FAST_ONLY 62 | * 63 | * @description: 64 | * A bit-flag to be OR-ed with the `flags` parameter of the 65 | * @FT_Get_Advance and @FT_Get_Advances functions. 66 | * 67 | * If set, it indicates that you want these functions to fail if the 68 | * corresponding hinting mode or font driver doesn't allow for very quick 69 | * advance computation. 70 | * 71 | * Typically, glyphs that are either unscaled, unhinted, bitmapped, or 72 | * light-hinted can have their advance width computed very quickly. 73 | * 74 | * Normal and bytecode hinted modes that require loading, scaling, and 75 | * hinting of the glyph outline, are extremely slow by comparison. 76 | */ 77 | #define FT_ADVANCE_FLAG_FAST_ONLY 0x20000000L 78 | 79 | 80 | /************************************************************************** 81 | * 82 | * @function: 83 | * FT_Get_Advance 84 | * 85 | * @description: 86 | * Retrieve the advance value of a given glyph outline in an @FT_Face. 87 | * 88 | * @input: 89 | * face :: 90 | * The source @FT_Face handle. 91 | * 92 | * gindex :: 93 | * The glyph index. 94 | * 95 | * load_flags :: 96 | * A set of bit flags similar to those used when calling 97 | * @FT_Load_Glyph, used to determine what kind of advances you need. 98 | * 99 | * @output: 100 | * padvance :: 101 | * The advance value. If scaling is performed (based on the value of 102 | * `load_flags`), the advance value is in 16.16 format. Otherwise, it 103 | * is in font units. 104 | * 105 | * If @FT_LOAD_VERTICAL_LAYOUT is set, this is the vertical advance 106 | * corresponding to a vertical layout. Otherwise, it is the horizontal 107 | * advance in a horizontal layout. 108 | * 109 | * @return: 110 | * FreeType error code. 0 means success. 111 | * 112 | * @note: 113 | * This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and if 114 | * the corresponding font backend doesn't have a quick way to retrieve 115 | * the advances. 116 | * 117 | * A scaled advance is returned in 16.16 format but isn't transformed by 118 | * the affine transformation specified by @FT_Set_Transform. 119 | */ 120 | FT_EXPORT( FT_Error ) 121 | FT_Get_Advance( FT_Face face, 122 | FT_UInt gindex, 123 | FT_Int32 load_flags, 124 | FT_Fixed *padvance ); 125 | 126 | 127 | /************************************************************************** 128 | * 129 | * @function: 130 | * FT_Get_Advances 131 | * 132 | * @description: 133 | * Retrieve the advance values of several glyph outlines in an @FT_Face. 134 | * 135 | * @input: 136 | * face :: 137 | * The source @FT_Face handle. 138 | * 139 | * start :: 140 | * The first glyph index. 141 | * 142 | * count :: 143 | * The number of advance values you want to retrieve. 144 | * 145 | * load_flags :: 146 | * A set of bit flags similar to those used when calling 147 | * @FT_Load_Glyph. 148 | * 149 | * @output: 150 | * padvance :: 151 | * The advance values. This array, to be provided by the caller, must 152 | * contain at least `count` elements. 153 | * 154 | * If scaling is performed (based on the value of `load_flags`), the 155 | * advance values are in 16.16 format. Otherwise, they are in font 156 | * units. 157 | * 158 | * If @FT_LOAD_VERTICAL_LAYOUT is set, these are the vertical advances 159 | * corresponding to a vertical layout. Otherwise, they are the 160 | * horizontal advances in a horizontal layout. 161 | * 162 | * @return: 163 | * FreeType error code. 0 means success. 164 | * 165 | * @note: 166 | * This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and if 167 | * the corresponding font backend doesn't have a quick way to retrieve 168 | * the advances. 169 | * 170 | * Scaled advances are returned in 16.16 format but aren't transformed by 171 | * the affine transformation specified by @FT_Set_Transform. 172 | */ 173 | FT_EXPORT( FT_Error ) 174 | FT_Get_Advances( FT_Face face, 175 | FT_UInt start, 176 | FT_UInt count, 177 | FT_Int32 load_flags, 178 | FT_Fixed *padvances ); 179 | 180 | /* */ 181 | 182 | 183 | FT_END_HEADER 184 | 185 | #endif /* FTADVANC_H_ */ 186 | 187 | 188 | /* END */ 189 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/ftbbox.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ftbbox.h 4 | * 5 | * FreeType exact bbox computation (specification). 6 | * 7 | * Copyright (C) 1996-2024 by 8 | * David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | 19 | /************************************************************************** 20 | * 21 | * This component has a _single_ role: to compute exact outline bounding 22 | * boxes. 23 | * 24 | * It is separated from the rest of the engine for various technical 25 | * reasons. It may well be integrated in 'ftoutln' later. 26 | * 27 | */ 28 | 29 | 30 | #ifndef FTBBOX_H_ 31 | #define FTBBOX_H_ 32 | 33 | 34 | #include 35 | 36 | #ifdef FREETYPE_H 37 | #error "freetype.h of FreeType 1 has been loaded!" 38 | #error "Please fix the directory search order for header files" 39 | #error "so that freetype.h of FreeType 2 is found first." 40 | #endif 41 | 42 | 43 | FT_BEGIN_HEADER 44 | 45 | 46 | /************************************************************************** 47 | * 48 | * @section: 49 | * outline_processing 50 | * 51 | */ 52 | 53 | 54 | /************************************************************************** 55 | * 56 | * @function: 57 | * FT_Outline_Get_BBox 58 | * 59 | * @description: 60 | * Compute the exact bounding box of an outline. This is slower than 61 | * computing the control box. However, it uses an advanced algorithm 62 | * that returns _very_ quickly when the two boxes coincide. Otherwise, 63 | * the outline Bezier arcs are traversed to extract their extrema. 64 | * 65 | * @input: 66 | * outline :: 67 | * A pointer to the source outline. 68 | * 69 | * @output: 70 | * abbox :: 71 | * The outline's exact bounding box. 72 | * 73 | * @return: 74 | * FreeType error code. 0~means success. 75 | * 76 | * @note: 77 | * If the font is tricky and the glyph has been loaded with 78 | * @FT_LOAD_NO_SCALE, the resulting BBox is meaningless. To get 79 | * reasonable values for the BBox it is necessary to load the glyph at a 80 | * large ppem value (so that the hinting instructions can properly shift 81 | * and scale the subglyphs), then extracting the BBox, which can be 82 | * eventually converted back to font units. 83 | */ 84 | FT_EXPORT( FT_Error ) 85 | FT_Outline_Get_BBox( FT_Outline* outline, 86 | FT_BBox *abbox ); 87 | 88 | /* */ 89 | 90 | 91 | FT_END_HEADER 92 | 93 | #endif /* FTBBOX_H_ */ 94 | 95 | 96 | /* END */ 97 | 98 | 99 | /* Local Variables: */ 100 | /* coding: utf-8 */ 101 | /* End: */ 102 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/ftbdf.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ftbdf.h 4 | * 5 | * FreeType API for accessing BDF-specific strings (specification). 6 | * 7 | * Copyright (C) 2002-2024 by 8 | * David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | 19 | #ifndef FTBDF_H_ 20 | #define FTBDF_H_ 21 | 22 | #include 23 | 24 | #ifdef FREETYPE_H 25 | #error "freetype.h of FreeType 1 has been loaded!" 26 | #error "Please fix the directory search order for header files" 27 | #error "so that freetype.h of FreeType 2 is found first." 28 | #endif 29 | 30 | 31 | FT_BEGIN_HEADER 32 | 33 | 34 | /************************************************************************** 35 | * 36 | * @section: 37 | * bdf_fonts 38 | * 39 | * @title: 40 | * BDF and PCF Files 41 | * 42 | * @abstract: 43 | * BDF and PCF specific API. 44 | * 45 | * @description: 46 | * This section contains the declaration of functions specific to BDF and 47 | * PCF fonts. 48 | * 49 | */ 50 | 51 | 52 | /************************************************************************** 53 | * 54 | * @enum: 55 | * BDF_PropertyType 56 | * 57 | * @description: 58 | * A list of BDF property types. 59 | * 60 | * @values: 61 | * BDF_PROPERTY_TYPE_NONE :: 62 | * Value~0 is used to indicate a missing property. 63 | * 64 | * BDF_PROPERTY_TYPE_ATOM :: 65 | * Property is a string atom. 66 | * 67 | * BDF_PROPERTY_TYPE_INTEGER :: 68 | * Property is a 32-bit signed integer. 69 | * 70 | * BDF_PROPERTY_TYPE_CARDINAL :: 71 | * Property is a 32-bit unsigned integer. 72 | */ 73 | typedef enum BDF_PropertyType_ 74 | { 75 | BDF_PROPERTY_TYPE_NONE = 0, 76 | BDF_PROPERTY_TYPE_ATOM = 1, 77 | BDF_PROPERTY_TYPE_INTEGER = 2, 78 | BDF_PROPERTY_TYPE_CARDINAL = 3 79 | 80 | } BDF_PropertyType; 81 | 82 | 83 | /************************************************************************** 84 | * 85 | * @type: 86 | * BDF_Property 87 | * 88 | * @description: 89 | * A handle to a @BDF_PropertyRec structure to model a given BDF/PCF 90 | * property. 91 | */ 92 | typedef struct BDF_PropertyRec_* BDF_Property; 93 | 94 | 95 | /************************************************************************** 96 | * 97 | * @struct: 98 | * BDF_PropertyRec 99 | * 100 | * @description: 101 | * This structure models a given BDF/PCF property. 102 | * 103 | * @fields: 104 | * type :: 105 | * The property type. 106 | * 107 | * u.atom :: 108 | * The atom string, if type is @BDF_PROPERTY_TYPE_ATOM. May be 109 | * `NULL`, indicating an empty string. 110 | * 111 | * u.integer :: 112 | * A signed integer, if type is @BDF_PROPERTY_TYPE_INTEGER. 113 | * 114 | * u.cardinal :: 115 | * An unsigned integer, if type is @BDF_PROPERTY_TYPE_CARDINAL. 116 | */ 117 | typedef struct BDF_PropertyRec_ 118 | { 119 | BDF_PropertyType type; 120 | union { 121 | const char* atom; 122 | FT_Int32 integer; 123 | FT_UInt32 cardinal; 124 | 125 | } u; 126 | 127 | } BDF_PropertyRec; 128 | 129 | 130 | /************************************************************************** 131 | * 132 | * @function: 133 | * FT_Get_BDF_Charset_ID 134 | * 135 | * @description: 136 | * Retrieve a BDF font character set identity, according to the BDF 137 | * specification. 138 | * 139 | * @input: 140 | * face :: 141 | * A handle to the input face. 142 | * 143 | * @output: 144 | * acharset_encoding :: 145 | * Charset encoding, as a C~string, owned by the face. 146 | * 147 | * acharset_registry :: 148 | * Charset registry, as a C~string, owned by the face. 149 | * 150 | * @return: 151 | * FreeType error code. 0~means success. 152 | * 153 | * @note: 154 | * This function only works with BDF faces, returning an error otherwise. 155 | */ 156 | FT_EXPORT( FT_Error ) 157 | FT_Get_BDF_Charset_ID( FT_Face face, 158 | const char* *acharset_encoding, 159 | const char* *acharset_registry ); 160 | 161 | 162 | /************************************************************************** 163 | * 164 | * @function: 165 | * FT_Get_BDF_Property 166 | * 167 | * @description: 168 | * Retrieve a BDF property from a BDF or PCF font file. 169 | * 170 | * @input: 171 | * face :: 172 | * A handle to the input face. 173 | * 174 | * name :: 175 | * The property name. 176 | * 177 | * @output: 178 | * aproperty :: 179 | * The property. 180 | * 181 | * @return: 182 | * FreeType error code. 0~means success. 183 | * 184 | * @note: 185 | * This function works with BDF _and_ PCF fonts. It returns an error 186 | * otherwise. It also returns an error if the property is not in the 187 | * font. 188 | * 189 | * A 'property' is a either key-value pair within the STARTPROPERTIES 190 | * ... ENDPROPERTIES block of a BDF font or a key-value pair from the 191 | * `info->props` array within a `FontRec` structure of a PCF font. 192 | * 193 | * Integer properties are always stored as 'signed' within PCF fonts; 194 | * consequently, @BDF_PROPERTY_TYPE_CARDINAL is a possible return value 195 | * for BDF fonts only. 196 | * 197 | * In case of error, `aproperty->type` is always set to 198 | * @BDF_PROPERTY_TYPE_NONE. 199 | */ 200 | FT_EXPORT( FT_Error ) 201 | FT_Get_BDF_Property( FT_Face face, 202 | const char* prop_name, 203 | BDF_PropertyRec *aproperty ); 204 | 205 | /* */ 206 | 207 | FT_END_HEADER 208 | 209 | #endif /* FTBDF_H_ */ 210 | 211 | 212 | /* END */ 213 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/ftbzip2.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ftbzip2.h 4 | * 5 | * Bzip2-compressed stream support. 6 | * 7 | * Copyright (C) 2010-2024 by 8 | * Joel Klinghed. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | 19 | #ifndef FTBZIP2_H_ 20 | #define FTBZIP2_H_ 21 | 22 | #include 23 | 24 | #ifdef FREETYPE_H 25 | #error "freetype.h of FreeType 1 has been loaded!" 26 | #error "Please fix the directory search order for header files" 27 | #error "so that freetype.h of FreeType 2 is found first." 28 | #endif 29 | 30 | 31 | FT_BEGIN_HEADER 32 | 33 | /************************************************************************** 34 | * 35 | * @section: 36 | * bzip2 37 | * 38 | * @title: 39 | * BZIP2 Streams 40 | * 41 | * @abstract: 42 | * Using bzip2-compressed font files. 43 | * 44 | * @description: 45 | * In certain builds of the library, bzip2 compression recognition is 46 | * automatically handled when calling @FT_New_Face or @FT_Open_Face. 47 | * This means that if no font driver is capable of handling the raw 48 | * compressed file, the library will try to open a bzip2 compressed 49 | * stream from it and re-open the face with it. 50 | * 51 | * The stream implementation is very basic and resets the decompression 52 | * process each time seeking backwards is needed within the stream, 53 | * which significantly undermines the performance. 54 | * 55 | * This section contains the declaration of Bzip2-specific functions. 56 | * 57 | */ 58 | 59 | 60 | /************************************************************************** 61 | * 62 | * @function: 63 | * FT_Stream_OpenBzip2 64 | * 65 | * @description: 66 | * Open a new stream to parse bzip2-compressed font files. This is 67 | * mainly used to support the compressed `*.pcf.bz2` fonts that come with 68 | * XFree86. 69 | * 70 | * @input: 71 | * stream :: 72 | * The target embedding stream. 73 | * 74 | * source :: 75 | * The source stream. 76 | * 77 | * @return: 78 | * FreeType error code. 0~means success. 79 | * 80 | * @note: 81 | * The source stream must be opened _before_ calling this function. 82 | * 83 | * Calling the internal function `FT_Stream_Close` on the new stream will 84 | * **not** call `FT_Stream_Close` on the source stream. None of the 85 | * stream objects will be released to the heap. 86 | * 87 | * This function may return `FT_Err_Unimplemented_Feature` if your build 88 | * of FreeType was not compiled with bzip2 support. 89 | */ 90 | FT_EXPORT( FT_Error ) 91 | FT_Stream_OpenBzip2( FT_Stream stream, 92 | FT_Stream source ); 93 | 94 | /* */ 95 | 96 | 97 | FT_END_HEADER 98 | 99 | #endif /* FTBZIP2_H_ */ 100 | 101 | 102 | /* END */ 103 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/ftchapters.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * This file defines the structure of the FreeType reference. 4 | * It is used by the python script that generates the HTML files. 5 | * 6 | */ 7 | 8 | 9 | /************************************************************************** 10 | * 11 | * @chapter: 12 | * general_remarks 13 | * 14 | * @title: 15 | * General Remarks 16 | * 17 | * @sections: 18 | * preamble 19 | * header_inclusion 20 | * user_allocation 21 | * 22 | */ 23 | 24 | 25 | /************************************************************************** 26 | * 27 | * @chapter: 28 | * core_api 29 | * 30 | * @title: 31 | * Core API 32 | * 33 | * @sections: 34 | * basic_types 35 | * library_setup 36 | * face_creation 37 | * font_testing_macros 38 | * sizing_and_scaling 39 | * glyph_retrieval 40 | * character_mapping 41 | * information_retrieval 42 | * other_api_data 43 | * 44 | */ 45 | 46 | 47 | /************************************************************************** 48 | * 49 | * @chapter: 50 | * extended_api 51 | * 52 | * @title: 53 | * Extended API 54 | * 55 | * @sections: 56 | * glyph_variants 57 | * color_management 58 | * layer_management 59 | * glyph_management 60 | * mac_specific 61 | * sizes_management 62 | * header_file_macros 63 | * 64 | */ 65 | 66 | 67 | /************************************************************************** 68 | * 69 | * @chapter: 70 | * format_specific 71 | * 72 | * @title: 73 | * Format-Specific API 74 | * 75 | * @sections: 76 | * multiple_masters 77 | * truetype_tables 78 | * type1_tables 79 | * sfnt_names 80 | * bdf_fonts 81 | * cid_fonts 82 | * pfr_fonts 83 | * winfnt_fonts 84 | * svg_fonts 85 | * font_formats 86 | * gasp_table 87 | * 88 | */ 89 | 90 | 91 | /************************************************************************** 92 | * 93 | * @chapter: 94 | * module_specific 95 | * 96 | * @title: 97 | * Controlling FreeType Modules 98 | * 99 | * @sections: 100 | * auto_hinter 101 | * cff_driver 102 | * t1_cid_driver 103 | * tt_driver 104 | * pcf_driver 105 | * ot_svg_driver 106 | * properties 107 | * parameter_tags 108 | * lcd_rendering 109 | * 110 | */ 111 | 112 | 113 | /************************************************************************** 114 | * 115 | * @chapter: 116 | * cache_subsystem 117 | * 118 | * @title: 119 | * Cache Sub-System 120 | * 121 | * @sections: 122 | * cache_subsystem 123 | * 124 | */ 125 | 126 | 127 | /************************************************************************** 128 | * 129 | * @chapter: 130 | * support_api 131 | * 132 | * @title: 133 | * Support API 134 | * 135 | * @sections: 136 | * computations 137 | * list_processing 138 | * outline_processing 139 | * quick_advance 140 | * bitmap_handling 141 | * raster 142 | * glyph_stroker 143 | * system_interface 144 | * module_management 145 | * gzip 146 | * lzw 147 | * bzip2 148 | * debugging_apis 149 | * 150 | */ 151 | 152 | 153 | /************************************************************************** 154 | * 155 | * @chapter: 156 | * error_codes 157 | * 158 | * @title: 159 | * Error Codes 160 | * 161 | * @sections: 162 | * error_enumerations 163 | * error_code_values 164 | * 165 | */ 166 | 167 | 168 | /* END */ 169 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/ftcid.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ftcid.h 4 | * 5 | * FreeType API for accessing CID font information (specification). 6 | * 7 | * Copyright (C) 2007-2024 by 8 | * Dereg Clegg and Michael Toftdal. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | 19 | #ifndef FTCID_H_ 20 | #define FTCID_H_ 21 | 22 | #include 23 | 24 | #ifdef FREETYPE_H 25 | #error "freetype.h of FreeType 1 has been loaded!" 26 | #error "Please fix the directory search order for header files" 27 | #error "so that freetype.h of FreeType 2 is found first." 28 | #endif 29 | 30 | 31 | FT_BEGIN_HEADER 32 | 33 | 34 | /************************************************************************** 35 | * 36 | * @section: 37 | * cid_fonts 38 | * 39 | * @title: 40 | * CID Fonts 41 | * 42 | * @abstract: 43 | * CID-keyed font-specific API. 44 | * 45 | * @description: 46 | * This section contains the declaration of CID-keyed font-specific 47 | * functions. 48 | * 49 | */ 50 | 51 | 52 | /************************************************************************** 53 | * 54 | * @function: 55 | * FT_Get_CID_Registry_Ordering_Supplement 56 | * 57 | * @description: 58 | * Retrieve the Registry/Ordering/Supplement triple (also known as the 59 | * "R/O/S") from a CID-keyed font. 60 | * 61 | * @input: 62 | * face :: 63 | * A handle to the input face. 64 | * 65 | * @output: 66 | * registry :: 67 | * The registry, as a C~string, owned by the face. 68 | * 69 | * ordering :: 70 | * The ordering, as a C~string, owned by the face. 71 | * 72 | * supplement :: 73 | * The supplement. 74 | * 75 | * @return: 76 | * FreeType error code. 0~means success. 77 | * 78 | * @note: 79 | * This function only works with CID faces, returning an error 80 | * otherwise. 81 | * 82 | * @since: 83 | * 2.3.6 84 | */ 85 | FT_EXPORT( FT_Error ) 86 | FT_Get_CID_Registry_Ordering_Supplement( FT_Face face, 87 | const char* *registry, 88 | const char* *ordering, 89 | FT_Int *supplement ); 90 | 91 | 92 | /************************************************************************** 93 | * 94 | * @function: 95 | * FT_Get_CID_Is_Internally_CID_Keyed 96 | * 97 | * @description: 98 | * Retrieve the type of the input face, CID keyed or not. In contrast 99 | * to the @FT_IS_CID_KEYED macro this function returns successfully also 100 | * for CID-keyed fonts in an SFNT wrapper. 101 | * 102 | * @input: 103 | * face :: 104 | * A handle to the input face. 105 | * 106 | * @output: 107 | * is_cid :: 108 | * The type of the face as an @FT_Bool. 109 | * 110 | * @return: 111 | * FreeType error code. 0~means success. 112 | * 113 | * @note: 114 | * This function only works with CID faces and OpenType fonts, returning 115 | * an error otherwise. 116 | * 117 | * @since: 118 | * 2.3.9 119 | */ 120 | FT_EXPORT( FT_Error ) 121 | FT_Get_CID_Is_Internally_CID_Keyed( FT_Face face, 122 | FT_Bool *is_cid ); 123 | 124 | 125 | /************************************************************************** 126 | * 127 | * @function: 128 | * FT_Get_CID_From_Glyph_Index 129 | * 130 | * @description: 131 | * Retrieve the CID of the input glyph index. 132 | * 133 | * @input: 134 | * face :: 135 | * A handle to the input face. 136 | * 137 | * glyph_index :: 138 | * The input glyph index. 139 | * 140 | * @output: 141 | * cid :: 142 | * The CID as an @FT_UInt. 143 | * 144 | * @return: 145 | * FreeType error code. 0~means success. 146 | * 147 | * @note: 148 | * This function only works with CID faces and OpenType fonts, returning 149 | * an error otherwise. 150 | * 151 | * @since: 152 | * 2.3.9 153 | */ 154 | FT_EXPORT( FT_Error ) 155 | FT_Get_CID_From_Glyph_Index( FT_Face face, 156 | FT_UInt glyph_index, 157 | FT_UInt *cid ); 158 | 159 | /* */ 160 | 161 | 162 | FT_END_HEADER 163 | 164 | #endif /* FTCID_H_ */ 165 | 166 | 167 | /* END */ 168 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/ftfntfmt.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ftfntfmt.h 4 | * 5 | * Support functions for font formats. 6 | * 7 | * Copyright (C) 2002-2024 by 8 | * David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | 19 | #ifndef FTFNTFMT_H_ 20 | #define FTFNTFMT_H_ 21 | 22 | #include 23 | 24 | #ifdef FREETYPE_H 25 | #error "freetype.h of FreeType 1 has been loaded!" 26 | #error "Please fix the directory search order for header files" 27 | #error "so that freetype.h of FreeType 2 is found first." 28 | #endif 29 | 30 | 31 | FT_BEGIN_HEADER 32 | 33 | 34 | /************************************************************************** 35 | * 36 | * @section: 37 | * font_formats 38 | * 39 | * @title: 40 | * Font Formats 41 | * 42 | * @abstract: 43 | * Getting the font format. 44 | * 45 | * @description: 46 | * The single function in this section can be used to get the font format. 47 | * Note that this information is not needed normally; however, there are 48 | * special cases (like in PDF devices) where it is important to 49 | * differentiate, in spite of FreeType's uniform API. 50 | * 51 | */ 52 | 53 | 54 | /************************************************************************** 55 | * 56 | * @function: 57 | * FT_Get_Font_Format 58 | * 59 | * @description: 60 | * Return a string describing the format of a given face. Possible values 61 | * are 'TrueType', 'Type~1', 'BDF', 'PCF', 'Type~42', 'CID~Type~1', 'CFF', 62 | * 'PFR', and 'Windows~FNT'. 63 | * 64 | * The return value is suitable to be used as an X11 FONT_PROPERTY. 65 | * 66 | * @input: 67 | * face :: 68 | * Input face handle. 69 | * 70 | * @return: 71 | * Font format string. `NULL` in case of error. 72 | * 73 | * @note: 74 | * A deprecated name for the same function is `FT_Get_X11_Font_Format`. 75 | */ 76 | FT_EXPORT( const char* ) 77 | FT_Get_Font_Format( FT_Face face ); 78 | 79 | 80 | /* deprecated */ 81 | FT_EXPORT( const char* ) 82 | FT_Get_X11_Font_Format( FT_Face face ); 83 | 84 | 85 | /* */ 86 | 87 | 88 | FT_END_HEADER 89 | 90 | #endif /* FTFNTFMT_H_ */ 91 | 92 | 93 | /* END */ 94 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/ftgasp.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ftgasp.h 4 | * 5 | * Access of TrueType's 'gasp' table (specification). 6 | * 7 | * Copyright (C) 2007-2024 by 8 | * David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | 19 | #ifndef FTGASP_H_ 20 | #define FTGASP_H_ 21 | 22 | #include 23 | 24 | #ifdef FREETYPE_H 25 | #error "freetype.h of FreeType 1 has been loaded!" 26 | #error "Please fix the directory search order for header files" 27 | #error "so that freetype.h of FreeType 2 is found first." 28 | #endif 29 | 30 | 31 | FT_BEGIN_HEADER 32 | 33 | 34 | /************************************************************************** 35 | * 36 | * @section: 37 | * gasp_table 38 | * 39 | * @title: 40 | * Gasp Table 41 | * 42 | * @abstract: 43 | * Retrieving TrueType 'gasp' table entries. 44 | * 45 | * @description: 46 | * The function @FT_Get_Gasp can be used to query a TrueType or OpenType 47 | * font for specific entries in its 'gasp' table, if any. This is mainly 48 | * useful when implementing native TrueType hinting with the bytecode 49 | * interpreter to duplicate the Windows text rendering results. 50 | */ 51 | 52 | /************************************************************************** 53 | * 54 | * @enum: 55 | * FT_GASP_XXX 56 | * 57 | * @description: 58 | * A list of values and/or bit-flags returned by the @FT_Get_Gasp 59 | * function. 60 | * 61 | * @values: 62 | * FT_GASP_NO_TABLE :: 63 | * This special value means that there is no GASP table in this face. 64 | * It is up to the client to decide what to do. 65 | * 66 | * FT_GASP_DO_GRIDFIT :: 67 | * Grid-fitting and hinting should be performed at the specified ppem. 68 | * This **really** means TrueType bytecode interpretation. If this bit 69 | * is not set, no hinting gets applied. 70 | * 71 | * FT_GASP_DO_GRAY :: 72 | * Anti-aliased rendering should be performed at the specified ppem. 73 | * If not set, do monochrome rendering. 74 | * 75 | * FT_GASP_SYMMETRIC_SMOOTHING :: 76 | * If set, smoothing along multiple axes must be used with ClearType. 77 | * 78 | * FT_GASP_SYMMETRIC_GRIDFIT :: 79 | * Grid-fitting must be used with ClearType's symmetric smoothing. 80 | * 81 | * @note: 82 | * The bit-flags `FT_GASP_DO_GRIDFIT` and `FT_GASP_DO_GRAY` are to be 83 | * used for standard font rasterization only. Independently of that, 84 | * `FT_GASP_SYMMETRIC_SMOOTHING` and `FT_GASP_SYMMETRIC_GRIDFIT` are to 85 | * be used if ClearType is enabled (and `FT_GASP_DO_GRIDFIT` and 86 | * `FT_GASP_DO_GRAY` are consequently ignored). 87 | * 88 | * 'ClearType' is Microsoft's implementation of LCD rendering, partly 89 | * protected by patents. 90 | * 91 | * @since: 92 | * 2.3.0 93 | */ 94 | #define FT_GASP_NO_TABLE -1 95 | #define FT_GASP_DO_GRIDFIT 0x01 96 | #define FT_GASP_DO_GRAY 0x02 97 | #define FT_GASP_SYMMETRIC_GRIDFIT 0x04 98 | #define FT_GASP_SYMMETRIC_SMOOTHING 0x08 99 | 100 | 101 | /************************************************************************** 102 | * 103 | * @function: 104 | * FT_Get_Gasp 105 | * 106 | * @description: 107 | * For a TrueType or OpenType font file, return the rasterizer behaviour 108 | * flags from the font's 'gasp' table corresponding to a given character 109 | * pixel size. 110 | * 111 | * @input: 112 | * face :: 113 | * The source face handle. 114 | * 115 | * ppem :: 116 | * The vertical character pixel size. 117 | * 118 | * @return: 119 | * Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE if there is no 120 | * 'gasp' table in the face. 121 | * 122 | * @note: 123 | * If you want to use the MM functionality of OpenType variation fonts 124 | * (i.e., using @FT_Set_Var_Design_Coordinates and friends), call this 125 | * function **after** setting an instance since the return values can 126 | * change. 127 | * 128 | * @since: 129 | * 2.3.0 130 | */ 131 | FT_EXPORT( FT_Int ) 132 | FT_Get_Gasp( FT_Face face, 133 | FT_UInt ppem ); 134 | 135 | /* */ 136 | 137 | 138 | FT_END_HEADER 139 | 140 | #endif /* FTGASP_H_ */ 141 | 142 | 143 | /* END */ 144 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/ftgzip.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ftgzip.h 4 | * 5 | * Gzip-compressed stream support. 6 | * 7 | * Copyright (C) 2002-2024 by 8 | * David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | 19 | #ifndef FTGZIP_H_ 20 | #define FTGZIP_H_ 21 | 22 | #include 23 | 24 | #ifdef FREETYPE_H 25 | #error "freetype.h of FreeType 1 has been loaded!" 26 | #error "Please fix the directory search order for header files" 27 | #error "so that freetype.h of FreeType 2 is found first." 28 | #endif 29 | 30 | 31 | FT_BEGIN_HEADER 32 | 33 | /************************************************************************** 34 | * 35 | * @section: 36 | * gzip 37 | * 38 | * @title: 39 | * GZIP Streams 40 | * 41 | * @abstract: 42 | * Using gzip-compressed font files. 43 | * 44 | * @description: 45 | * In certain builds of the library, gzip compression recognition is 46 | * automatically handled when calling @FT_New_Face or @FT_Open_Face. 47 | * This means that if no font driver is capable of handling the raw 48 | * compressed file, the library will try to open a gzipped stream from it 49 | * and re-open the face with it. 50 | * 51 | * The stream implementation is very basic and resets the decompression 52 | * process each time seeking backwards is needed within the stream, 53 | * which significantly undermines the performance. 54 | * 55 | * This section contains the declaration of Gzip-specific functions. 56 | * 57 | */ 58 | 59 | 60 | /************************************************************************** 61 | * 62 | * @function: 63 | * FT_Stream_OpenGzip 64 | * 65 | * @description: 66 | * Open a new stream to parse gzip-compressed font files. This is mainly 67 | * used to support the compressed `*.pcf.gz` fonts that come with 68 | * XFree86. 69 | * 70 | * @input: 71 | * stream :: 72 | * The target embedding stream. 73 | * 74 | * source :: 75 | * The source stream. 76 | * 77 | * @return: 78 | * FreeType error code. 0~means success. 79 | * 80 | * @note: 81 | * The source stream must be opened _before_ calling this function. 82 | * 83 | * Calling the internal function `FT_Stream_Close` on the new stream will 84 | * **not** call `FT_Stream_Close` on the source stream. None of the 85 | * stream objects will be released to the heap. 86 | * 87 | * This function may return `FT_Err_Unimplemented_Feature` if your build 88 | * of FreeType was not compiled with zlib support. 89 | */ 90 | FT_EXPORT( FT_Error ) 91 | FT_Stream_OpenGzip( FT_Stream stream, 92 | FT_Stream source ); 93 | 94 | 95 | /************************************************************************** 96 | * 97 | * @function: 98 | * FT_Gzip_Uncompress 99 | * 100 | * @description: 101 | * Decompress a zipped input buffer into an output buffer. This function 102 | * is modeled after zlib's `uncompress` function. 103 | * 104 | * @input: 105 | * memory :: 106 | * A FreeType memory handle. 107 | * 108 | * input :: 109 | * The input buffer. 110 | * 111 | * input_len :: 112 | * The length of the input buffer. 113 | * 114 | * @output: 115 | * output :: 116 | * The output buffer. 117 | * 118 | * @inout: 119 | * output_len :: 120 | * Before calling the function, this is the total size of the output 121 | * buffer, which must be large enough to hold the entire uncompressed 122 | * data (so the size of the uncompressed data must be known in 123 | * advance). After calling the function, `output_len` is the size of 124 | * the used data in `output`. 125 | * 126 | * @return: 127 | * FreeType error code. 0~means success. 128 | * 129 | * @note: 130 | * This function may return `FT_Err_Unimplemented_Feature` if your build 131 | * of FreeType was not compiled with zlib support. 132 | * 133 | * @since: 134 | * 2.5.1 135 | */ 136 | FT_EXPORT( FT_Error ) 137 | FT_Gzip_Uncompress( FT_Memory memory, 138 | FT_Byte* output, 139 | FT_ULong* output_len, 140 | const FT_Byte* input, 141 | FT_ULong input_len ); 142 | 143 | /* */ 144 | 145 | 146 | FT_END_HEADER 147 | 148 | #endif /* FTGZIP_H_ */ 149 | 150 | 151 | /* END */ 152 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/ftlist.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ftlist.h 4 | * 5 | * Generic list support for FreeType (specification). 6 | * 7 | * Copyright (C) 1996-2024 by 8 | * David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | 19 | /************************************************************************** 20 | * 21 | * This file implements functions relative to list processing. Its data 22 | * structures are defined in `freetype.h`. 23 | * 24 | */ 25 | 26 | 27 | #ifndef FTLIST_H_ 28 | #define FTLIST_H_ 29 | 30 | 31 | #include 32 | 33 | #ifdef FREETYPE_H 34 | #error "freetype.h of FreeType 1 has been loaded!" 35 | #error "Please fix the directory search order for header files" 36 | #error "so that freetype.h of FreeType 2 is found first." 37 | #endif 38 | 39 | 40 | FT_BEGIN_HEADER 41 | 42 | 43 | /************************************************************************** 44 | * 45 | * @section: 46 | * list_processing 47 | * 48 | * @title: 49 | * List Processing 50 | * 51 | * @abstract: 52 | * Simple management of lists. 53 | * 54 | * @description: 55 | * This section contains various definitions related to list processing 56 | * using doubly-linked nodes. 57 | * 58 | * @order: 59 | * FT_List 60 | * FT_ListNode 61 | * FT_ListRec 62 | * FT_ListNodeRec 63 | * 64 | * FT_List_Add 65 | * FT_List_Insert 66 | * FT_List_Find 67 | * FT_List_Remove 68 | * FT_List_Up 69 | * FT_List_Iterate 70 | * FT_List_Iterator 71 | * FT_List_Finalize 72 | * FT_List_Destructor 73 | * 74 | */ 75 | 76 | 77 | /************************************************************************** 78 | * 79 | * @function: 80 | * FT_List_Find 81 | * 82 | * @description: 83 | * Find the list node for a given listed object. 84 | * 85 | * @input: 86 | * list :: 87 | * A pointer to the parent list. 88 | * data :: 89 | * The address of the listed object. 90 | * 91 | * @return: 92 | * List node. `NULL` if it wasn't found. 93 | */ 94 | FT_EXPORT( FT_ListNode ) 95 | FT_List_Find( FT_List list, 96 | void* data ); 97 | 98 | 99 | /************************************************************************** 100 | * 101 | * @function: 102 | * FT_List_Add 103 | * 104 | * @description: 105 | * Append an element to the end of a list. 106 | * 107 | * @inout: 108 | * list :: 109 | * A pointer to the parent list. 110 | * node :: 111 | * The node to append. 112 | */ 113 | FT_EXPORT( void ) 114 | FT_List_Add( FT_List list, 115 | FT_ListNode node ); 116 | 117 | 118 | /************************************************************************** 119 | * 120 | * @function: 121 | * FT_List_Insert 122 | * 123 | * @description: 124 | * Insert an element at the head of a list. 125 | * 126 | * @inout: 127 | * list :: 128 | * A pointer to parent list. 129 | * node :: 130 | * The node to insert. 131 | */ 132 | FT_EXPORT( void ) 133 | FT_List_Insert( FT_List list, 134 | FT_ListNode node ); 135 | 136 | 137 | /************************************************************************** 138 | * 139 | * @function: 140 | * FT_List_Remove 141 | * 142 | * @description: 143 | * Remove a node from a list. This function doesn't check whether the 144 | * node is in the list! 145 | * 146 | * @input: 147 | * node :: 148 | * The node to remove. 149 | * 150 | * @inout: 151 | * list :: 152 | * A pointer to the parent list. 153 | */ 154 | FT_EXPORT( void ) 155 | FT_List_Remove( FT_List list, 156 | FT_ListNode node ); 157 | 158 | 159 | /************************************************************************** 160 | * 161 | * @function: 162 | * FT_List_Up 163 | * 164 | * @description: 165 | * Move a node to the head/top of a list. Used to maintain LRU lists. 166 | * 167 | * @inout: 168 | * list :: 169 | * A pointer to the parent list. 170 | * node :: 171 | * The node to move. 172 | */ 173 | FT_EXPORT( void ) 174 | FT_List_Up( FT_List list, 175 | FT_ListNode node ); 176 | 177 | 178 | /************************************************************************** 179 | * 180 | * @functype: 181 | * FT_List_Iterator 182 | * 183 | * @description: 184 | * An FT_List iterator function that is called during a list parse by 185 | * @FT_List_Iterate. 186 | * 187 | * @input: 188 | * node :: 189 | * The current iteration list node. 190 | * 191 | * user :: 192 | * A typeless pointer passed to @FT_List_Iterate. Can be used to point 193 | * to the iteration's state. 194 | */ 195 | typedef FT_Error 196 | (*FT_List_Iterator)( FT_ListNode node, 197 | void* user ); 198 | 199 | 200 | /************************************************************************** 201 | * 202 | * @function: 203 | * FT_List_Iterate 204 | * 205 | * @description: 206 | * Parse a list and calls a given iterator function on each element. 207 | * Note that parsing is stopped as soon as one of the iterator calls 208 | * returns a non-zero value. 209 | * 210 | * @input: 211 | * list :: 212 | * A handle to the list. 213 | * iterator :: 214 | * An iterator function, called on each node of the list. 215 | * user :: 216 | * A user-supplied field that is passed as the second argument to the 217 | * iterator. 218 | * 219 | * @return: 220 | * The result (a FreeType error code) of the last iterator call. 221 | */ 222 | FT_EXPORT( FT_Error ) 223 | FT_List_Iterate( FT_List list, 224 | FT_List_Iterator iterator, 225 | void* user ); 226 | 227 | 228 | /************************************************************************** 229 | * 230 | * @functype: 231 | * FT_List_Destructor 232 | * 233 | * @description: 234 | * An @FT_List iterator function that is called during a list 235 | * finalization by @FT_List_Finalize to destroy all elements in a given 236 | * list. 237 | * 238 | * @input: 239 | * system :: 240 | * The current system object. 241 | * 242 | * data :: 243 | * The current object to destroy. 244 | * 245 | * user :: 246 | * A typeless pointer passed to @FT_List_Iterate. It can be used to 247 | * point to the iteration's state. 248 | */ 249 | typedef void 250 | (*FT_List_Destructor)( FT_Memory memory, 251 | void* data, 252 | void* user ); 253 | 254 | 255 | /************************************************************************** 256 | * 257 | * @function: 258 | * FT_List_Finalize 259 | * 260 | * @description: 261 | * Destroy all elements in the list as well as the list itself. 262 | * 263 | * @input: 264 | * list :: 265 | * A handle to the list. 266 | * 267 | * destroy :: 268 | * A list destructor that will be applied to each element of the list. 269 | * Set this to `NULL` if not needed. 270 | * 271 | * memory :: 272 | * The current memory object that handles deallocation. 273 | * 274 | * user :: 275 | * A user-supplied field that is passed as the last argument to the 276 | * destructor. 277 | * 278 | * @note: 279 | * This function expects that all nodes added by @FT_List_Add or 280 | * @FT_List_Insert have been dynamically allocated. 281 | */ 282 | FT_EXPORT( void ) 283 | FT_List_Finalize( FT_List list, 284 | FT_List_Destructor destroy, 285 | FT_Memory memory, 286 | void* user ); 287 | 288 | /* */ 289 | 290 | 291 | FT_END_HEADER 292 | 293 | #endif /* FTLIST_H_ */ 294 | 295 | 296 | /* END */ 297 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/ftlogging.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ftlogging.h 4 | * 5 | * Additional debugging APIs. 6 | * 7 | * Copyright (C) 2020-2024 by 8 | * David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | 19 | #ifndef FTLOGGING_H_ 20 | #define FTLOGGING_H_ 21 | 22 | 23 | #include 24 | #include FT_CONFIG_CONFIG_H 25 | 26 | 27 | FT_BEGIN_HEADER 28 | 29 | 30 | /************************************************************************** 31 | * 32 | * @section: 33 | * debugging_apis 34 | * 35 | * @title: 36 | * External Debugging APIs 37 | * 38 | * @abstract: 39 | * Public APIs to control the `FT_DEBUG_LOGGING` macro. 40 | * 41 | * @description: 42 | * This section contains the declarations of public functions that 43 | * enables fine control of what the `FT_DEBUG_LOGGING` macro outputs. 44 | * 45 | */ 46 | 47 | 48 | /************************************************************************** 49 | * 50 | * @function: 51 | * FT_Trace_Set_Level 52 | * 53 | * @description: 54 | * Change the levels of tracing components of FreeType at run time. 55 | * 56 | * @input: 57 | * tracing_level :: 58 | * New tracing value. 59 | * 60 | * @example: 61 | * The following call makes FreeType trace everything but the 'memory' 62 | * component. 63 | * 64 | * ``` 65 | * FT_Trace_Set_Level( "any:7 memory:0" ); 66 | * ``` 67 | * 68 | * @note: 69 | * This function does nothing if compilation option `FT_DEBUG_LOGGING` 70 | * isn't set. 71 | * 72 | * @since: 73 | * 2.11 74 | * 75 | */ 76 | FT_EXPORT( void ) 77 | FT_Trace_Set_Level( const char* tracing_level ); 78 | 79 | 80 | /************************************************************************** 81 | * 82 | * @function: 83 | * FT_Trace_Set_Default_Level 84 | * 85 | * @description: 86 | * Reset tracing value of FreeType's components to the default value 87 | * (i.e., to the value of the `FT2_DEBUG` environment value or to NULL 88 | * if `FT2_DEBUG` is not set). 89 | * 90 | * @note: 91 | * This function does nothing if compilation option `FT_DEBUG_LOGGING` 92 | * isn't set. 93 | * 94 | * @since: 95 | * 2.11 96 | * 97 | */ 98 | FT_EXPORT( void ) 99 | FT_Trace_Set_Default_Level( void ); 100 | 101 | 102 | /************************************************************************** 103 | * 104 | * @functype: 105 | * FT_Custom_Log_Handler 106 | * 107 | * @description: 108 | * A function typedef that is used to handle the logging of tracing and 109 | * debug messages on a file system. 110 | * 111 | * @input: 112 | * ft_component :: 113 | * The name of `FT_COMPONENT` from which the current debug or error 114 | * message is produced. 115 | * 116 | * fmt :: 117 | * Actual debug or tracing message. 118 | * 119 | * args:: 120 | * Arguments of debug or tracing messages. 121 | * 122 | * @since: 123 | * 2.11 124 | * 125 | */ 126 | typedef void 127 | (*FT_Custom_Log_Handler)( const char* ft_component, 128 | const char* fmt, 129 | va_list args ); 130 | 131 | 132 | /************************************************************************** 133 | * 134 | * @function: 135 | * FT_Set_Log_Handler 136 | * 137 | * @description: 138 | * A function to set a custom log handler. 139 | * 140 | * @input: 141 | * handler :: 142 | * New logging function. 143 | * 144 | * @note: 145 | * This function does nothing if compilation option `FT_DEBUG_LOGGING` 146 | * isn't set. 147 | * 148 | * @since: 149 | * 2.11 150 | * 151 | */ 152 | FT_EXPORT( void ) 153 | FT_Set_Log_Handler( FT_Custom_Log_Handler handler ); 154 | 155 | 156 | /************************************************************************** 157 | * 158 | * @function: 159 | * FT_Set_Default_Log_Handler 160 | * 161 | * @description: 162 | * A function to undo the effect of @FT_Set_Log_Handler, resetting the 163 | * log handler to FreeType's built-in version. 164 | * 165 | * @note: 166 | * This function does nothing if compilation option `FT_DEBUG_LOGGING` 167 | * isn't set. 168 | * 169 | * @since: 170 | * 2.11 171 | * 172 | */ 173 | FT_EXPORT( void ) 174 | FT_Set_Default_Log_Handler( void ); 175 | 176 | /* */ 177 | 178 | 179 | FT_END_HEADER 180 | 181 | #endif /* FTLOGGING_H_ */ 182 | 183 | 184 | /* END */ 185 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/ftlzw.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ftlzw.h 4 | * 5 | * LZW-compressed stream support. 6 | * 7 | * Copyright (C) 2004-2024 by 8 | * David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | 19 | #ifndef FTLZW_H_ 20 | #define FTLZW_H_ 21 | 22 | #include 23 | 24 | #ifdef FREETYPE_H 25 | #error "freetype.h of FreeType 1 has been loaded!" 26 | #error "Please fix the directory search order for header files" 27 | #error "so that freetype.h of FreeType 2 is found first." 28 | #endif 29 | 30 | 31 | FT_BEGIN_HEADER 32 | 33 | /************************************************************************** 34 | * 35 | * @section: 36 | * lzw 37 | * 38 | * @title: 39 | * LZW Streams 40 | * 41 | * @abstract: 42 | * Using LZW-compressed font files. 43 | * 44 | * @description: 45 | * In certain builds of the library, LZW compression recognition is 46 | * automatically handled when calling @FT_New_Face or @FT_Open_Face. 47 | * This means that if no font driver is capable of handling the raw 48 | * compressed file, the library will try to open a LZW stream from it and 49 | * re-open the face with it. 50 | * 51 | * The stream implementation is very basic and resets the decompression 52 | * process each time seeking backwards is needed within the stream, 53 | * which significantly undermines the performance. 54 | * 55 | * This section contains the declaration of LZW-specific functions. 56 | * 57 | */ 58 | 59 | /************************************************************************** 60 | * 61 | * @function: 62 | * FT_Stream_OpenLZW 63 | * 64 | * @description: 65 | * Open a new stream to parse LZW-compressed font files. This is mainly 66 | * used to support the compressed `*.pcf.Z` fonts that come with XFree86. 67 | * 68 | * @input: 69 | * stream :: 70 | * The target embedding stream. 71 | * 72 | * source :: 73 | * The source stream. 74 | * 75 | * @return: 76 | * FreeType error code. 0~means success. 77 | * 78 | * @note: 79 | * The source stream must be opened _before_ calling this function. 80 | * 81 | * Calling the internal function `FT_Stream_Close` on the new stream will 82 | * **not** call `FT_Stream_Close` on the source stream. None of the 83 | * stream objects will be released to the heap. 84 | * 85 | * This function may return `FT_Err_Unimplemented_Feature` if your build 86 | * of FreeType was not compiled with LZW support. 87 | */ 88 | FT_EXPORT( FT_Error ) 89 | FT_Stream_OpenLZW( FT_Stream stream, 90 | FT_Stream source ); 91 | 92 | /* */ 93 | 94 | 95 | FT_END_HEADER 96 | 97 | #endif /* FTLZW_H_ */ 98 | 99 | 100 | /* END */ 101 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/ftmac.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ftmac.h 4 | * 5 | * Additional Mac-specific API. 6 | * 7 | * Copyright (C) 1996-2024 by 8 | * Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | 19 | /**************************************************************************** 20 | * 21 | * NOTE: Include this file after `FT_FREETYPE_H` and after any 22 | * Mac-specific headers (because this header uses Mac types such as 23 | * 'Handle', 'FSSpec', 'FSRef', etc.) 24 | * 25 | */ 26 | 27 | 28 | #ifndef FTMAC_H_ 29 | #define FTMAC_H_ 30 | 31 | 32 | 33 | 34 | FT_BEGIN_HEADER 35 | 36 | 37 | /* gcc-3.1 and later can warn about functions tagged as deprecated */ 38 | #ifndef FT_DEPRECATED_ATTRIBUTE 39 | #if defined( __GNUC__ ) && \ 40 | ( ( __GNUC__ >= 4 ) || \ 41 | ( ( __GNUC__ == 3 ) && ( __GNUC_MINOR__ >= 1 ) ) ) 42 | #define FT_DEPRECATED_ATTRIBUTE __attribute__(( deprecated )) 43 | #else 44 | #define FT_DEPRECATED_ATTRIBUTE 45 | #endif 46 | #endif 47 | 48 | 49 | /************************************************************************** 50 | * 51 | * @section: 52 | * mac_specific 53 | * 54 | * @title: 55 | * Mac Specific Interface 56 | * 57 | * @abstract: 58 | * Only available on the Macintosh. 59 | * 60 | * @description: 61 | * The following definitions are only available if FreeType is compiled 62 | * on a Macintosh. 63 | * 64 | */ 65 | 66 | 67 | /************************************************************************** 68 | * 69 | * @function: 70 | * FT_New_Face_From_FOND 71 | * 72 | * @description: 73 | * Create a new face object from a FOND resource. 74 | * 75 | * @inout: 76 | * library :: 77 | * A handle to the library resource. 78 | * 79 | * @input: 80 | * fond :: 81 | * A FOND resource. 82 | * 83 | * face_index :: 84 | * Only supported for the -1 'sanity check' special case. 85 | * 86 | * @output: 87 | * aface :: 88 | * A handle to a new face object. 89 | * 90 | * @return: 91 | * FreeType error code. 0~means success. 92 | * 93 | * @example: 94 | * This function can be used to create @FT_Face objects from fonts that 95 | * are installed in the system as follows. 96 | * 97 | * ``` 98 | * fond = GetResource( 'FOND', fontName ); 99 | * error = FT_New_Face_From_FOND( library, fond, 0, &face ); 100 | * ``` 101 | */ 102 | FT_EXPORT( FT_Error ) 103 | FT_New_Face_From_FOND( FT_Library library, 104 | Handle fond, 105 | FT_Long face_index, 106 | FT_Face *aface ) 107 | FT_DEPRECATED_ATTRIBUTE; 108 | 109 | 110 | /************************************************************************** 111 | * 112 | * @function: 113 | * FT_GetFile_From_Mac_Name 114 | * 115 | * @description: 116 | * Return an FSSpec for the disk file containing the named font. 117 | * 118 | * @input: 119 | * fontName :: 120 | * Mac OS name of the font (e.g., Times New Roman Bold). 121 | * 122 | * @output: 123 | * pathSpec :: 124 | * FSSpec to the file. For passing to @FT_New_Face_From_FSSpec. 125 | * 126 | * face_index :: 127 | * Index of the face. For passing to @FT_New_Face_From_FSSpec. 128 | * 129 | * @return: 130 | * FreeType error code. 0~means success. 131 | */ 132 | FT_EXPORT( FT_Error ) 133 | FT_GetFile_From_Mac_Name( const char* fontName, 134 | FSSpec* pathSpec, 135 | FT_Long* face_index ) 136 | FT_DEPRECATED_ATTRIBUTE; 137 | 138 | 139 | /************************************************************************** 140 | * 141 | * @function: 142 | * FT_GetFile_From_Mac_ATS_Name 143 | * 144 | * @description: 145 | * Return an FSSpec for the disk file containing the named font. 146 | * 147 | * @input: 148 | * fontName :: 149 | * Mac OS name of the font in ATS framework. 150 | * 151 | * @output: 152 | * pathSpec :: 153 | * FSSpec to the file. For passing to @FT_New_Face_From_FSSpec. 154 | * 155 | * face_index :: 156 | * Index of the face. For passing to @FT_New_Face_From_FSSpec. 157 | * 158 | * @return: 159 | * FreeType error code. 0~means success. 160 | */ 161 | FT_EXPORT( FT_Error ) 162 | FT_GetFile_From_Mac_ATS_Name( const char* fontName, 163 | FSSpec* pathSpec, 164 | FT_Long* face_index ) 165 | FT_DEPRECATED_ATTRIBUTE; 166 | 167 | 168 | /************************************************************************** 169 | * 170 | * @function: 171 | * FT_GetFilePath_From_Mac_ATS_Name 172 | * 173 | * @description: 174 | * Return a pathname of the disk file and face index for given font name 175 | * that is handled by ATS framework. 176 | * 177 | * @input: 178 | * fontName :: 179 | * Mac OS name of the font in ATS framework. 180 | * 181 | * @output: 182 | * path :: 183 | * Buffer to store pathname of the file. For passing to @FT_New_Face. 184 | * The client must allocate this buffer before calling this function. 185 | * 186 | * maxPathSize :: 187 | * Lengths of the buffer `path` that client allocated. 188 | * 189 | * face_index :: 190 | * Index of the face. For passing to @FT_New_Face. 191 | * 192 | * @return: 193 | * FreeType error code. 0~means success. 194 | */ 195 | FT_EXPORT( FT_Error ) 196 | FT_GetFilePath_From_Mac_ATS_Name( const char* fontName, 197 | UInt8* path, 198 | UInt32 maxPathSize, 199 | FT_Long* face_index ) 200 | FT_DEPRECATED_ATTRIBUTE; 201 | 202 | 203 | /************************************************************************** 204 | * 205 | * @function: 206 | * FT_New_Face_From_FSSpec 207 | * 208 | * @description: 209 | * Create a new face object from a given resource and typeface index 210 | * using an FSSpec to the font file. 211 | * 212 | * @inout: 213 | * library :: 214 | * A handle to the library resource. 215 | * 216 | * @input: 217 | * spec :: 218 | * FSSpec to the font file. 219 | * 220 | * face_index :: 221 | * The index of the face within the resource. The first face has 222 | * index~0. 223 | * @output: 224 | * aface :: 225 | * A handle to a new face object. 226 | * 227 | * @return: 228 | * FreeType error code. 0~means success. 229 | * 230 | * @note: 231 | * @FT_New_Face_From_FSSpec is identical to @FT_New_Face except it 232 | * accepts an FSSpec instead of a path. 233 | */ 234 | FT_EXPORT( FT_Error ) 235 | FT_New_Face_From_FSSpec( FT_Library library, 236 | const FSSpec *spec, 237 | FT_Long face_index, 238 | FT_Face *aface ) 239 | FT_DEPRECATED_ATTRIBUTE; 240 | 241 | 242 | /************************************************************************** 243 | * 244 | * @function: 245 | * FT_New_Face_From_FSRef 246 | * 247 | * @description: 248 | * Create a new face object from a given resource and typeface index 249 | * using an FSRef to the font file. 250 | * 251 | * @inout: 252 | * library :: 253 | * A handle to the library resource. 254 | * 255 | * @input: 256 | * spec :: 257 | * FSRef to the font file. 258 | * 259 | * face_index :: 260 | * The index of the face within the resource. The first face has 261 | * index~0. 262 | * @output: 263 | * aface :: 264 | * A handle to a new face object. 265 | * 266 | * @return: 267 | * FreeType error code. 0~means success. 268 | * 269 | * @note: 270 | * @FT_New_Face_From_FSRef is identical to @FT_New_Face except it accepts 271 | * an FSRef instead of a path. 272 | */ 273 | FT_EXPORT( FT_Error ) 274 | FT_New_Face_From_FSRef( FT_Library library, 275 | const FSRef *ref, 276 | FT_Long face_index, 277 | FT_Face *aface ) 278 | FT_DEPRECATED_ATTRIBUTE; 279 | 280 | /* */ 281 | 282 | 283 | FT_END_HEADER 284 | 285 | 286 | #endif /* FTMAC_H_ */ 287 | 288 | 289 | /* END */ 290 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/ftmoderr.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ftmoderr.h 4 | * 5 | * FreeType module error offsets (specification). 6 | * 7 | * Copyright (C) 2001-2024 by 8 | * David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | 19 | /************************************************************************** 20 | * 21 | * This file is used to define the FreeType module error codes. 22 | * 23 | * If the macro `FT_CONFIG_OPTION_USE_MODULE_ERRORS` in `ftoption.h` is 24 | * set, the lower byte of an error value identifies the error code as 25 | * usual. In addition, the higher byte identifies the module. For 26 | * example, the error `FT_Err_Invalid_File_Format` has value 0x0003, the 27 | * error `TT_Err_Invalid_File_Format` has value 0x1303, the error 28 | * `T1_Err_Invalid_File_Format` has value 0x1403, etc. 29 | * 30 | * Note that `FT_Err_Ok`, `TT_Err_Ok`, etc. are always equal to zero, 31 | * including the high byte. 32 | * 33 | * If `FT_CONFIG_OPTION_USE_MODULE_ERRORS` isn't set, the higher byte of an 34 | * error value is set to zero. 35 | * 36 | * To hide the various `XXX_Err_` prefixes in the source code, FreeType 37 | * provides some macros in `fttypes.h`. 38 | * 39 | * FT_ERR( err ) 40 | * 41 | * Add current error module prefix (as defined with the `FT_ERR_PREFIX` 42 | * macro) to `err`. For example, in the BDF module the line 43 | * 44 | * ``` 45 | * error = FT_ERR( Invalid_Outline ); 46 | * ``` 47 | * 48 | * expands to 49 | * 50 | * ``` 51 | * error = BDF_Err_Invalid_Outline; 52 | * ``` 53 | * 54 | * For simplicity, you can always use `FT_Err_Ok` directly instead of 55 | * `FT_ERR( Ok )`. 56 | * 57 | * FT_ERR_EQ( errcode, err ) 58 | * FT_ERR_NEQ( errcode, err ) 59 | * 60 | * Compare error code `errcode` with the error `err` for equality and 61 | * inequality, respectively. Example: 62 | * 63 | * ``` 64 | * if ( FT_ERR_EQ( error, Invalid_Outline ) ) 65 | * ... 66 | * ``` 67 | * 68 | * Using this macro you don't have to think about error prefixes. Of 69 | * course, if module errors are not active, the above example is the 70 | * same as 71 | * 72 | * ``` 73 | * if ( error == FT_Err_Invalid_Outline ) 74 | * ... 75 | * ``` 76 | * 77 | * FT_ERROR_BASE( errcode ) 78 | * FT_ERROR_MODULE( errcode ) 79 | * 80 | * Get base error and module error code, respectively. 81 | * 82 | * It can also be used to create a module error message table easily with 83 | * something like 84 | * 85 | * ``` 86 | * #undef FTMODERR_H_ 87 | * #define FT_MODERRDEF( e, v, s ) { FT_Mod_Err_ ## e, s }, 88 | * #define FT_MODERR_START_LIST { 89 | * #define FT_MODERR_END_LIST { 0, 0 } }; 90 | * 91 | * const struct 92 | * { 93 | * int mod_err_offset; 94 | * const char* mod_err_msg 95 | * } ft_mod_errors[] = 96 | * 97 | * #include 98 | * ``` 99 | * 100 | */ 101 | 102 | 103 | #ifndef FTMODERR_H_ 104 | #define FTMODERR_H_ 105 | 106 | 107 | /*******************************************************************/ 108 | /*******************************************************************/ 109 | /***** *****/ 110 | /***** SETUP MACROS *****/ 111 | /***** *****/ 112 | /*******************************************************************/ 113 | /*******************************************************************/ 114 | 115 | 116 | #undef FT_NEED_EXTERN_C 117 | 118 | #ifndef FT_MODERRDEF 119 | 120 | #ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS 121 | #define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = v, 122 | #else 123 | #define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = 0, 124 | #endif 125 | 126 | #define FT_MODERR_START_LIST enum { 127 | #define FT_MODERR_END_LIST FT_Mod_Err_Max }; 128 | 129 | #ifdef __cplusplus 130 | #define FT_NEED_EXTERN_C 131 | extern "C" { 132 | #endif 133 | 134 | #endif /* !FT_MODERRDEF */ 135 | 136 | 137 | /*******************************************************************/ 138 | /*******************************************************************/ 139 | /***** *****/ 140 | /***** LIST MODULE ERROR BASES *****/ 141 | /***** *****/ 142 | /*******************************************************************/ 143 | /*******************************************************************/ 144 | 145 | 146 | #ifdef FT_MODERR_START_LIST 147 | FT_MODERR_START_LIST 148 | #endif 149 | 150 | 151 | FT_MODERRDEF( Base, 0x000, "base module" ) 152 | FT_MODERRDEF( Autofit, 0x100, "autofitter module" ) 153 | FT_MODERRDEF( BDF, 0x200, "BDF module" ) 154 | FT_MODERRDEF( Bzip2, 0x300, "Bzip2 module" ) 155 | FT_MODERRDEF( Cache, 0x400, "cache module" ) 156 | FT_MODERRDEF( CFF, 0x500, "CFF module" ) 157 | FT_MODERRDEF( CID, 0x600, "CID module" ) 158 | FT_MODERRDEF( Gzip, 0x700, "Gzip module" ) 159 | FT_MODERRDEF( LZW, 0x800, "LZW module" ) 160 | FT_MODERRDEF( OTvalid, 0x900, "OpenType validation module" ) 161 | FT_MODERRDEF( PCF, 0xA00, "PCF module" ) 162 | FT_MODERRDEF( PFR, 0xB00, "PFR module" ) 163 | FT_MODERRDEF( PSaux, 0xC00, "PS auxiliary module" ) 164 | FT_MODERRDEF( PShinter, 0xD00, "PS hinter module" ) 165 | FT_MODERRDEF( PSnames, 0xE00, "PS names module" ) 166 | FT_MODERRDEF( Raster, 0xF00, "raster module" ) 167 | FT_MODERRDEF( SFNT, 0x1000, "SFNT module" ) 168 | FT_MODERRDEF( Smooth, 0x1100, "smooth raster module" ) 169 | FT_MODERRDEF( TrueType, 0x1200, "TrueType module" ) 170 | FT_MODERRDEF( Type1, 0x1300, "Type 1 module" ) 171 | FT_MODERRDEF( Type42, 0x1400, "Type 42 module" ) 172 | FT_MODERRDEF( Winfonts, 0x1500, "Windows FON/FNT module" ) 173 | FT_MODERRDEF( GXvalid, 0x1600, "GX validation module" ) 174 | FT_MODERRDEF( Sdf, 0x1700, "Signed distance field raster module" ) 175 | 176 | 177 | #ifdef FT_MODERR_END_LIST 178 | FT_MODERR_END_LIST 179 | #endif 180 | 181 | 182 | /*******************************************************************/ 183 | /*******************************************************************/ 184 | /***** *****/ 185 | /***** CLEANUP *****/ 186 | /***** *****/ 187 | /*******************************************************************/ 188 | /*******************************************************************/ 189 | 190 | 191 | #ifdef FT_NEED_EXTERN_C 192 | } 193 | #endif 194 | 195 | #undef FT_MODERR_START_LIST 196 | #undef FT_MODERR_END_LIST 197 | #undef FT_MODERRDEF 198 | #undef FT_NEED_EXTERN_C 199 | 200 | 201 | #endif /* FTMODERR_H_ */ 202 | 203 | 204 | /* END */ 205 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/ftotval.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ftotval.h 4 | * 5 | * FreeType API for validating OpenType tables (specification). 6 | * 7 | * Copyright (C) 2004-2024 by 8 | * David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | 19 | /**************************************************************************** 20 | * 21 | * 22 | * Warning: This module might be moved to a different library in the 23 | * future to avoid a tight dependency between FreeType and the 24 | * OpenType specification. 25 | * 26 | * 27 | */ 28 | 29 | 30 | #ifndef FTOTVAL_H_ 31 | #define FTOTVAL_H_ 32 | 33 | #include 34 | 35 | #ifdef FREETYPE_H 36 | #error "freetype.h of FreeType 1 has been loaded!" 37 | #error "Please fix the directory search order for header files" 38 | #error "so that freetype.h of FreeType 2 is found first." 39 | #endif 40 | 41 | 42 | FT_BEGIN_HEADER 43 | 44 | 45 | /************************************************************************** 46 | * 47 | * @section: 48 | * ot_validation 49 | * 50 | * @title: 51 | * OpenType Validation 52 | * 53 | * @abstract: 54 | * An API to validate OpenType tables. 55 | * 56 | * @description: 57 | * This section contains the declaration of functions to validate some 58 | * OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH). 59 | * 60 | * @order: 61 | * FT_OpenType_Validate 62 | * FT_OpenType_Free 63 | * 64 | * FT_VALIDATE_OTXXX 65 | * 66 | */ 67 | 68 | 69 | /************************************************************************** 70 | * 71 | * @enum: 72 | * FT_VALIDATE_OTXXX 73 | * 74 | * @description: 75 | * A list of bit-field constants used with @FT_OpenType_Validate to 76 | * indicate which OpenType tables should be validated. 77 | * 78 | * @values: 79 | * FT_VALIDATE_BASE :: 80 | * Validate BASE table. 81 | * 82 | * FT_VALIDATE_GDEF :: 83 | * Validate GDEF table. 84 | * 85 | * FT_VALIDATE_GPOS :: 86 | * Validate GPOS table. 87 | * 88 | * FT_VALIDATE_GSUB :: 89 | * Validate GSUB table. 90 | * 91 | * FT_VALIDATE_JSTF :: 92 | * Validate JSTF table. 93 | * 94 | * FT_VALIDATE_MATH :: 95 | * Validate MATH table. 96 | * 97 | * FT_VALIDATE_OT :: 98 | * Validate all OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH). 99 | * 100 | */ 101 | #define FT_VALIDATE_BASE 0x0100 102 | #define FT_VALIDATE_GDEF 0x0200 103 | #define FT_VALIDATE_GPOS 0x0400 104 | #define FT_VALIDATE_GSUB 0x0800 105 | #define FT_VALIDATE_JSTF 0x1000 106 | #define FT_VALIDATE_MATH 0x2000 107 | 108 | #define FT_VALIDATE_OT ( FT_VALIDATE_BASE | \ 109 | FT_VALIDATE_GDEF | \ 110 | FT_VALIDATE_GPOS | \ 111 | FT_VALIDATE_GSUB | \ 112 | FT_VALIDATE_JSTF | \ 113 | FT_VALIDATE_MATH ) 114 | 115 | 116 | /************************************************************************** 117 | * 118 | * @function: 119 | * FT_OpenType_Validate 120 | * 121 | * @description: 122 | * Validate various OpenType tables to assure that all offsets and 123 | * indices are valid. The idea is that a higher-level library that 124 | * actually does the text layout can access those tables without error 125 | * checking (which can be quite time consuming). 126 | * 127 | * @input: 128 | * face :: 129 | * A handle to the input face. 130 | * 131 | * validation_flags :: 132 | * A bit field that specifies the tables to be validated. See 133 | * @FT_VALIDATE_OTXXX for possible values. 134 | * 135 | * @output: 136 | * BASE_table :: 137 | * A pointer to the BASE table. 138 | * 139 | * GDEF_table :: 140 | * A pointer to the GDEF table. 141 | * 142 | * GPOS_table :: 143 | * A pointer to the GPOS table. 144 | * 145 | * GSUB_table :: 146 | * A pointer to the GSUB table. 147 | * 148 | * JSTF_table :: 149 | * A pointer to the JSTF table. 150 | * 151 | * @return: 152 | * FreeType error code. 0~means success. 153 | * 154 | * @note: 155 | * This function only works with OpenType fonts, returning an error 156 | * otherwise. 157 | * 158 | * After use, the application should deallocate the five tables with 159 | * @FT_OpenType_Free. A `NULL` value indicates that the table either 160 | * doesn't exist in the font, or the application hasn't asked for 161 | * validation. 162 | */ 163 | FT_EXPORT( FT_Error ) 164 | FT_OpenType_Validate( FT_Face face, 165 | FT_UInt validation_flags, 166 | FT_Bytes *BASE_table, 167 | FT_Bytes *GDEF_table, 168 | FT_Bytes *GPOS_table, 169 | FT_Bytes *GSUB_table, 170 | FT_Bytes *JSTF_table ); 171 | 172 | 173 | /************************************************************************** 174 | * 175 | * @function: 176 | * FT_OpenType_Free 177 | * 178 | * @description: 179 | * Free the buffer allocated by OpenType validator. 180 | * 181 | * @input: 182 | * face :: 183 | * A handle to the input face. 184 | * 185 | * table :: 186 | * The pointer to the buffer that is allocated by 187 | * @FT_OpenType_Validate. 188 | * 189 | * @note: 190 | * This function must be used to free the buffer allocated by 191 | * @FT_OpenType_Validate only. 192 | */ 193 | FT_EXPORT( void ) 194 | FT_OpenType_Free( FT_Face face, 195 | FT_Bytes table ); 196 | 197 | 198 | /* */ 199 | 200 | 201 | FT_END_HEADER 202 | 203 | #endif /* FTOTVAL_H_ */ 204 | 205 | 206 | /* END */ 207 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/ftparams.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ftparams.h 4 | * 5 | * FreeType API for possible FT_Parameter tags (specification only). 6 | * 7 | * Copyright (C) 2017-2024 by 8 | * David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | 19 | #ifndef FTPARAMS_H_ 20 | #define FTPARAMS_H_ 21 | 22 | #include 23 | 24 | #ifdef FREETYPE_H 25 | #error "freetype.h of FreeType 1 has been loaded!" 26 | #error "Please fix the directory search order for header files" 27 | #error "so that freetype.h of FreeType 2 is found first." 28 | #endif 29 | 30 | 31 | FT_BEGIN_HEADER 32 | 33 | 34 | /************************************************************************** 35 | * 36 | * @section: 37 | * parameter_tags 38 | * 39 | * @title: 40 | * Parameter Tags 41 | * 42 | * @abstract: 43 | * Macros for driver property and font loading parameter tags. 44 | * 45 | * @description: 46 | * This section contains macros for the @FT_Parameter structure that are 47 | * used with various functions to activate some special functionality or 48 | * different behaviour of various components of FreeType. 49 | * 50 | */ 51 | 52 | 53 | /************************************************************************** 54 | * 55 | * @enum: 56 | * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY 57 | * 58 | * @description: 59 | * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic 60 | * family names in the 'name' table (introduced in OpenType version 1.4). 61 | * Use this for backward compatibility with legacy systems that have a 62 | * four-faces-per-family restriction. 63 | * 64 | * @since: 65 | * 2.8 66 | * 67 | */ 68 | #define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY \ 69 | FT_MAKE_TAG( 'i', 'g', 'p', 'f' ) 70 | 71 | 72 | /* this constant is deprecated */ 73 | #define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY \ 74 | FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY 75 | 76 | 77 | /************************************************************************** 78 | * 79 | * @enum: 80 | * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY 81 | * 82 | * @description: 83 | * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic 84 | * subfamily names in the 'name' table (introduced in OpenType version 85 | * 1.4). Use this for backward compatibility with legacy systems that 86 | * have a four-faces-per-family restriction. 87 | * 88 | * @since: 89 | * 2.8 90 | * 91 | */ 92 | #define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY \ 93 | FT_MAKE_TAG( 'i', 'g', 'p', 's' ) 94 | 95 | 96 | /* this constant is deprecated */ 97 | #define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY \ 98 | FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY 99 | 100 | 101 | /************************************************************************** 102 | * 103 | * @enum: 104 | * FT_PARAM_TAG_INCREMENTAL 105 | * 106 | * @description: 107 | * An @FT_Parameter tag to be used with @FT_Open_Face to indicate 108 | * incremental glyph loading. 109 | * 110 | */ 111 | #define FT_PARAM_TAG_INCREMENTAL \ 112 | FT_MAKE_TAG( 'i', 'n', 'c', 'r' ) 113 | 114 | 115 | /************************************************************************** 116 | * 117 | * @enum: 118 | * FT_PARAM_TAG_IGNORE_SBIX 119 | * 120 | * @description: 121 | * A tag for @FT_Parameter to make @FT_Open_Face ignore an 'sbix' table 122 | * while loading a font. Use this if @FT_FACE_FLAG_SBIX is set and you 123 | * want to access the outline glyphs in the font. 124 | * 125 | */ 126 | #define FT_PARAM_TAG_IGNORE_SBIX \ 127 | FT_MAKE_TAG( 'i', 's', 'b', 'x' ) 128 | 129 | 130 | /************************************************************************** 131 | * 132 | * @enum: 133 | * FT_PARAM_TAG_LCD_FILTER_WEIGHTS 134 | * 135 | * @description: 136 | * An @FT_Parameter tag to be used with @FT_Face_Properties. The 137 | * corresponding argument specifies the five LCD filter weights for a 138 | * given face (if using @FT_LOAD_TARGET_LCD, for example), overriding the 139 | * global default values or the values set up with 140 | * @FT_Library_SetLcdFilterWeights. 141 | * 142 | * @since: 143 | * 2.8 144 | * 145 | */ 146 | #define FT_PARAM_TAG_LCD_FILTER_WEIGHTS \ 147 | FT_MAKE_TAG( 'l', 'c', 'd', 'f' ) 148 | 149 | 150 | /************************************************************************** 151 | * 152 | * @enum: 153 | * FT_PARAM_TAG_RANDOM_SEED 154 | * 155 | * @description: 156 | * An @FT_Parameter tag to be used with @FT_Face_Properties. The 157 | * corresponding 32bit signed integer argument overrides the font 158 | * driver's random seed value with a face-specific one; see @random-seed. 159 | * 160 | * @since: 161 | * 2.8 162 | * 163 | */ 164 | #define FT_PARAM_TAG_RANDOM_SEED \ 165 | FT_MAKE_TAG( 's', 'e', 'e', 'd' ) 166 | 167 | 168 | /************************************************************************** 169 | * 170 | * @enum: 171 | * FT_PARAM_TAG_STEM_DARKENING 172 | * 173 | * @description: 174 | * An @FT_Parameter tag to be used with @FT_Face_Properties. The 175 | * corresponding Boolean argument specifies whether to apply stem 176 | * darkening, overriding the global default values or the values set up 177 | * with @FT_Property_Set (see @no-stem-darkening). 178 | * 179 | * This is a passive setting that only takes effect if the font driver or 180 | * autohinter honors it, which the CFF, Type~1, and CID drivers always 181 | * do, but the autohinter only in 'light' hinting mode (as of version 182 | * 2.9). 183 | * 184 | * @since: 185 | * 2.8 186 | * 187 | */ 188 | #define FT_PARAM_TAG_STEM_DARKENING \ 189 | FT_MAKE_TAG( 'd', 'a', 'r', 'k' ) 190 | 191 | 192 | /************************************************************************** 193 | * 194 | * @enum: 195 | * FT_PARAM_TAG_UNPATENTED_HINTING 196 | * 197 | * @description: 198 | * Deprecated, no effect. 199 | * 200 | * Previously: A constant used as the tag of an @FT_Parameter structure 201 | * to indicate that unpatented methods only should be used by the 202 | * TrueType bytecode interpreter for a typeface opened by @FT_Open_Face. 203 | * 204 | */ 205 | #define FT_PARAM_TAG_UNPATENTED_HINTING \ 206 | FT_MAKE_TAG( 'u', 'n', 'p', 'a' ) 207 | 208 | 209 | /* */ 210 | 211 | 212 | FT_END_HEADER 213 | 214 | 215 | #endif /* FTPARAMS_H_ */ 216 | 217 | 218 | /* END */ 219 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/ftpfr.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ftpfr.h 4 | * 5 | * FreeType API for accessing PFR-specific data (specification only). 6 | * 7 | * Copyright (C) 2002-2024 by 8 | * David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | 19 | #ifndef FTPFR_H_ 20 | #define FTPFR_H_ 21 | 22 | #include 23 | 24 | #ifdef FREETYPE_H 25 | #error "freetype.h of FreeType 1 has been loaded!" 26 | #error "Please fix the directory search order for header files" 27 | #error "so that freetype.h of FreeType 2 is found first." 28 | #endif 29 | 30 | 31 | FT_BEGIN_HEADER 32 | 33 | 34 | /************************************************************************** 35 | * 36 | * @section: 37 | * pfr_fonts 38 | * 39 | * @title: 40 | * PFR Fonts 41 | * 42 | * @abstract: 43 | * PFR/TrueDoc-specific API. 44 | * 45 | * @description: 46 | * This section contains the declaration of PFR-specific functions. 47 | * 48 | */ 49 | 50 | 51 | /************************************************************************** 52 | * 53 | * @function: 54 | * FT_Get_PFR_Metrics 55 | * 56 | * @description: 57 | * Return the outline and metrics resolutions of a given PFR face. 58 | * 59 | * @input: 60 | * face :: 61 | * Handle to the input face. It can be a non-PFR face. 62 | * 63 | * @output: 64 | * aoutline_resolution :: 65 | * Outline resolution. This is equivalent to `face->units_per_EM` for 66 | * non-PFR fonts. Optional (parameter can be `NULL`). 67 | * 68 | * ametrics_resolution :: 69 | * Metrics resolution. This is equivalent to `outline_resolution` for 70 | * non-PFR fonts. Optional (parameter can be `NULL`). 71 | * 72 | * ametrics_x_scale :: 73 | * A 16.16 fixed-point number used to scale distance expressed in 74 | * metrics units to device subpixels. This is equivalent to 75 | * `face->size->x_scale`, but for metrics only. Optional (parameter 76 | * can be `NULL`). 77 | * 78 | * ametrics_y_scale :: 79 | * Same as `ametrics_x_scale` but for the vertical direction. 80 | * optional (parameter can be `NULL`). 81 | * 82 | * @return: 83 | * FreeType error code. 0~means success. 84 | * 85 | * @note: 86 | * If the input face is not a PFR, this function will return an error. 87 | * However, in all cases, it will return valid values. 88 | */ 89 | FT_EXPORT( FT_Error ) 90 | FT_Get_PFR_Metrics( FT_Face face, 91 | FT_UInt *aoutline_resolution, 92 | FT_UInt *ametrics_resolution, 93 | FT_Fixed *ametrics_x_scale, 94 | FT_Fixed *ametrics_y_scale ); 95 | 96 | 97 | /************************************************************************** 98 | * 99 | * @function: 100 | * FT_Get_PFR_Kerning 101 | * 102 | * @description: 103 | * Return the kerning pair corresponding to two glyphs in a PFR face. 104 | * The distance is expressed in metrics units, unlike the result of 105 | * @FT_Get_Kerning. 106 | * 107 | * @input: 108 | * face :: 109 | * A handle to the input face. 110 | * 111 | * left :: 112 | * Index of the left glyph. 113 | * 114 | * right :: 115 | * Index of the right glyph. 116 | * 117 | * @output: 118 | * avector :: 119 | * A kerning vector. 120 | * 121 | * @return: 122 | * FreeType error code. 0~means success. 123 | * 124 | * @note: 125 | * This function always return distances in original PFR metrics units. 126 | * This is unlike @FT_Get_Kerning with the @FT_KERNING_UNSCALED mode, 127 | * which always returns distances converted to outline units. 128 | * 129 | * You can use the value of the `x_scale` and `y_scale` parameters 130 | * returned by @FT_Get_PFR_Metrics to scale these to device subpixels. 131 | */ 132 | FT_EXPORT( FT_Error ) 133 | FT_Get_PFR_Kerning( FT_Face face, 134 | FT_UInt left, 135 | FT_UInt right, 136 | FT_Vector *avector ); 137 | 138 | 139 | /************************************************************************** 140 | * 141 | * @function: 142 | * FT_Get_PFR_Advance 143 | * 144 | * @description: 145 | * Return a given glyph advance, expressed in original metrics units, 146 | * from a PFR font. 147 | * 148 | * @input: 149 | * face :: 150 | * A handle to the input face. 151 | * 152 | * gindex :: 153 | * The glyph index. 154 | * 155 | * @output: 156 | * aadvance :: 157 | * The glyph advance in metrics units. 158 | * 159 | * @return: 160 | * FreeType error code. 0~means success. 161 | * 162 | * @note: 163 | * You can use the `x_scale` or `y_scale` results of @FT_Get_PFR_Metrics 164 | * to convert the advance to device subpixels (i.e., 1/64 of pixels). 165 | */ 166 | FT_EXPORT( FT_Error ) 167 | FT_Get_PFR_Advance( FT_Face face, 168 | FT_UInt gindex, 169 | FT_Pos *aadvance ); 170 | 171 | /* */ 172 | 173 | 174 | FT_END_HEADER 175 | 176 | #endif /* FTPFR_H_ */ 177 | 178 | 179 | /* END */ 180 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/ftrender.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ftrender.h 4 | * 5 | * FreeType renderer modules public interface (specification). 6 | * 7 | * Copyright (C) 1996-2024 by 8 | * David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | 19 | #ifndef FTRENDER_H_ 20 | #define FTRENDER_H_ 21 | 22 | 23 | #include 24 | #include 25 | 26 | 27 | FT_BEGIN_HEADER 28 | 29 | 30 | /************************************************************************** 31 | * 32 | * @section: 33 | * module_management 34 | * 35 | */ 36 | 37 | 38 | /* create a new glyph object */ 39 | typedef FT_Error 40 | (*FT_Glyph_InitFunc)( FT_Glyph glyph, 41 | FT_GlyphSlot slot ); 42 | 43 | /* destroys a given glyph object */ 44 | typedef void 45 | (*FT_Glyph_DoneFunc)( FT_Glyph glyph ); 46 | 47 | typedef void 48 | (*FT_Glyph_TransformFunc)( FT_Glyph glyph, 49 | const FT_Matrix* matrix, 50 | const FT_Vector* delta ); 51 | 52 | typedef void 53 | (*FT_Glyph_GetBBoxFunc)( FT_Glyph glyph, 54 | FT_BBox* abbox ); 55 | 56 | typedef FT_Error 57 | (*FT_Glyph_CopyFunc)( FT_Glyph source, 58 | FT_Glyph target ); 59 | 60 | typedef FT_Error 61 | (*FT_Glyph_PrepareFunc)( FT_Glyph glyph, 62 | FT_GlyphSlot slot ); 63 | 64 | /* deprecated */ 65 | #define FT_Glyph_Init_Func FT_Glyph_InitFunc 66 | #define FT_Glyph_Done_Func FT_Glyph_DoneFunc 67 | #define FT_Glyph_Transform_Func FT_Glyph_TransformFunc 68 | #define FT_Glyph_BBox_Func FT_Glyph_GetBBoxFunc 69 | #define FT_Glyph_Copy_Func FT_Glyph_CopyFunc 70 | #define FT_Glyph_Prepare_Func FT_Glyph_PrepareFunc 71 | 72 | 73 | struct FT_Glyph_Class_ 74 | { 75 | FT_Long glyph_size; 76 | FT_Glyph_Format glyph_format; 77 | 78 | FT_Glyph_InitFunc glyph_init; 79 | FT_Glyph_DoneFunc glyph_done; 80 | FT_Glyph_CopyFunc glyph_copy; 81 | FT_Glyph_TransformFunc glyph_transform; 82 | FT_Glyph_GetBBoxFunc glyph_bbox; 83 | FT_Glyph_PrepareFunc glyph_prepare; 84 | }; 85 | 86 | 87 | typedef FT_Error 88 | (*FT_Renderer_RenderFunc)( FT_Renderer renderer, 89 | FT_GlyphSlot slot, 90 | FT_Render_Mode mode, 91 | const FT_Vector* origin ); 92 | 93 | typedef FT_Error 94 | (*FT_Renderer_TransformFunc)( FT_Renderer renderer, 95 | FT_GlyphSlot slot, 96 | const FT_Matrix* matrix, 97 | const FT_Vector* delta ); 98 | 99 | 100 | typedef void 101 | (*FT_Renderer_GetCBoxFunc)( FT_Renderer renderer, 102 | FT_GlyphSlot slot, 103 | FT_BBox* cbox ); 104 | 105 | 106 | typedef FT_Error 107 | (*FT_Renderer_SetModeFunc)( FT_Renderer renderer, 108 | FT_ULong mode_tag, 109 | FT_Pointer mode_ptr ); 110 | 111 | /* deprecated identifiers */ 112 | #define FTRenderer_render FT_Renderer_RenderFunc 113 | #define FTRenderer_transform FT_Renderer_TransformFunc 114 | #define FTRenderer_getCBox FT_Renderer_GetCBoxFunc 115 | #define FTRenderer_setMode FT_Renderer_SetModeFunc 116 | 117 | 118 | /************************************************************************** 119 | * 120 | * @struct: 121 | * FT_Renderer_Class 122 | * 123 | * @description: 124 | * The renderer module class descriptor. 125 | * 126 | * @fields: 127 | * root :: 128 | * The root @FT_Module_Class fields. 129 | * 130 | * glyph_format :: 131 | * The glyph image format this renderer handles. 132 | * 133 | * render_glyph :: 134 | * A method used to render the image that is in a given glyph slot into 135 | * a bitmap. 136 | * 137 | * transform_glyph :: 138 | * A method used to transform the image that is in a given glyph slot. 139 | * 140 | * get_glyph_cbox :: 141 | * A method used to access the glyph's cbox. 142 | * 143 | * set_mode :: 144 | * A method used to pass additional parameters. 145 | * 146 | * raster_class :: 147 | * For @FT_GLYPH_FORMAT_OUTLINE renderers only. This is a pointer to 148 | * its raster's class. 149 | */ 150 | typedef struct FT_Renderer_Class_ 151 | { 152 | FT_Module_Class root; 153 | 154 | FT_Glyph_Format glyph_format; 155 | 156 | FT_Renderer_RenderFunc render_glyph; 157 | FT_Renderer_TransformFunc transform_glyph; 158 | FT_Renderer_GetCBoxFunc get_glyph_cbox; 159 | FT_Renderer_SetModeFunc set_mode; 160 | 161 | const FT_Raster_Funcs* raster_class; 162 | 163 | } FT_Renderer_Class; 164 | 165 | 166 | /************************************************************************** 167 | * 168 | * @function: 169 | * FT_Get_Renderer 170 | * 171 | * @description: 172 | * Retrieve the current renderer for a given glyph format. 173 | * 174 | * @input: 175 | * library :: 176 | * A handle to the library object. 177 | * 178 | * format :: 179 | * The glyph format. 180 | * 181 | * @return: 182 | * A renderer handle. 0~if none found. 183 | * 184 | * @note: 185 | * An error will be returned if a module already exists by that name, or 186 | * if the module requires a version of FreeType that is too great. 187 | * 188 | * To add a new renderer, simply use @FT_Add_Module. To retrieve a 189 | * renderer by its name, use @FT_Get_Module. 190 | */ 191 | FT_EXPORT( FT_Renderer ) 192 | FT_Get_Renderer( FT_Library library, 193 | FT_Glyph_Format format ); 194 | 195 | 196 | /************************************************************************** 197 | * 198 | * @function: 199 | * FT_Set_Renderer 200 | * 201 | * @description: 202 | * Set the current renderer to use, and set additional mode. 203 | * 204 | * @inout: 205 | * library :: 206 | * A handle to the library object. 207 | * 208 | * @input: 209 | * renderer :: 210 | * A handle to the renderer object. 211 | * 212 | * num_params :: 213 | * The number of additional parameters. 214 | * 215 | * parameters :: 216 | * Additional parameters. 217 | * 218 | * @return: 219 | * FreeType error code. 0~means success. 220 | * 221 | * @note: 222 | * In case of success, the renderer will be used to convert glyph images 223 | * in the renderer's known format into bitmaps. 224 | * 225 | * This doesn't change the current renderer for other formats. 226 | * 227 | * Currently, no FreeType renderer module uses `parameters`; you should 228 | * thus always pass `NULL` as the value. 229 | */ 230 | FT_EXPORT( FT_Error ) 231 | FT_Set_Renderer( FT_Library library, 232 | FT_Renderer renderer, 233 | FT_UInt num_params, 234 | FT_Parameter* parameters ); 235 | 236 | /* */ 237 | 238 | 239 | FT_END_HEADER 240 | 241 | #endif /* FTRENDER_H_ */ 242 | 243 | 244 | /* END */ 245 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/ftsizes.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ftsizes.h 4 | * 5 | * FreeType size objects management (specification). 6 | * 7 | * Copyright (C) 1996-2024 by 8 | * David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | 19 | /************************************************************************** 20 | * 21 | * Typical application would normally not need to use these functions. 22 | * However, they have been placed in a public API for the rare cases where 23 | * they are needed. 24 | * 25 | */ 26 | 27 | 28 | #ifndef FTSIZES_H_ 29 | #define FTSIZES_H_ 30 | 31 | 32 | #include 33 | 34 | #ifdef FREETYPE_H 35 | #error "freetype.h of FreeType 1 has been loaded!" 36 | #error "Please fix the directory search order for header files" 37 | #error "so that freetype.h of FreeType 2 is found first." 38 | #endif 39 | 40 | 41 | FT_BEGIN_HEADER 42 | 43 | 44 | /************************************************************************** 45 | * 46 | * @section: 47 | * sizes_management 48 | * 49 | * @title: 50 | * Size Management 51 | * 52 | * @abstract: 53 | * Managing multiple sizes per face. 54 | * 55 | * @description: 56 | * When creating a new face object (e.g., with @FT_New_Face), an @FT_Size 57 | * object is automatically created and used to store all pixel-size 58 | * dependent information, available in the `face->size` field. 59 | * 60 | * It is however possible to create more sizes for a given face, mostly 61 | * in order to manage several character pixel sizes of the same font 62 | * family and style. See @FT_New_Size and @FT_Done_Size. 63 | * 64 | * Note that @FT_Set_Pixel_Sizes and @FT_Set_Char_Size only modify the 65 | * contents of the current 'active' size; you thus need to use 66 | * @FT_Activate_Size to change it. 67 | * 68 | * 99% of applications won't need the functions provided here, especially 69 | * if they use the caching sub-system, so be cautious when using these. 70 | * 71 | */ 72 | 73 | 74 | /************************************************************************** 75 | * 76 | * @function: 77 | * FT_New_Size 78 | * 79 | * @description: 80 | * Create a new size object from a given face object. 81 | * 82 | * @input: 83 | * face :: 84 | * A handle to a parent face object. 85 | * 86 | * @output: 87 | * asize :: 88 | * A handle to a new size object. 89 | * 90 | * @return: 91 | * FreeType error code. 0~means success. 92 | * 93 | * @note: 94 | * You need to call @FT_Activate_Size in order to select the new size for 95 | * upcoming calls to @FT_Set_Pixel_Sizes, @FT_Set_Char_Size, 96 | * @FT_Load_Glyph, @FT_Load_Char, etc. 97 | */ 98 | FT_EXPORT( FT_Error ) 99 | FT_New_Size( FT_Face face, 100 | FT_Size* size ); 101 | 102 | 103 | /************************************************************************** 104 | * 105 | * @function: 106 | * FT_Done_Size 107 | * 108 | * @description: 109 | * Discard a given size object. Note that @FT_Done_Face automatically 110 | * discards all size objects allocated with @FT_New_Size. 111 | * 112 | * @input: 113 | * size :: 114 | * A handle to a target size object. 115 | * 116 | * @return: 117 | * FreeType error code. 0~means success. 118 | */ 119 | FT_EXPORT( FT_Error ) 120 | FT_Done_Size( FT_Size size ); 121 | 122 | 123 | /************************************************************************** 124 | * 125 | * @function: 126 | * FT_Activate_Size 127 | * 128 | * @description: 129 | * Even though it is possible to create several size objects for a given 130 | * face (see @FT_New_Size for details), functions like @FT_Load_Glyph or 131 | * @FT_Load_Char only use the one that has been activated last to 132 | * determine the 'current character pixel size'. 133 | * 134 | * This function can be used to 'activate' a previously created size 135 | * object. 136 | * 137 | * @input: 138 | * size :: 139 | * A handle to a target size object. 140 | * 141 | * @return: 142 | * FreeType error code. 0~means success. 143 | * 144 | * @note: 145 | * If `face` is the size's parent face object, this function changes the 146 | * value of `face->size` to the input size handle. 147 | */ 148 | FT_EXPORT( FT_Error ) 149 | FT_Activate_Size( FT_Size size ); 150 | 151 | /* */ 152 | 153 | 154 | FT_END_HEADER 155 | 156 | #endif /* FTSIZES_H_ */ 157 | 158 | 159 | /* END */ 160 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/ftsnames.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ftsnames.h 4 | * 5 | * Simple interface to access SFNT 'name' tables (which are used 6 | * to hold font names, copyright info, notices, etc.) (specification). 7 | * 8 | * This is _not_ used to retrieve glyph names! 9 | * 10 | * Copyright (C) 1996-2024 by 11 | * David Turner, Robert Wilhelm, and Werner Lemberg. 12 | * 13 | * This file is part of the FreeType project, and may only be used, 14 | * modified, and distributed under the terms of the FreeType project 15 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 16 | * this file you indicate that you have read the license and 17 | * understand and accept it fully. 18 | * 19 | */ 20 | 21 | 22 | #ifndef FTSNAMES_H_ 23 | #define FTSNAMES_H_ 24 | 25 | 26 | #include 27 | #include 28 | 29 | #ifdef FREETYPE_H 30 | #error "freetype.h of FreeType 1 has been loaded!" 31 | #error "Please fix the directory search order for header files" 32 | #error "so that freetype.h of FreeType 2 is found first." 33 | #endif 34 | 35 | 36 | FT_BEGIN_HEADER 37 | 38 | 39 | /************************************************************************** 40 | * 41 | * @section: 42 | * sfnt_names 43 | * 44 | * @title: 45 | * SFNT Names 46 | * 47 | * @abstract: 48 | * Access the names embedded in TrueType and OpenType files. 49 | * 50 | * @description: 51 | * The TrueType and OpenType specifications allow the inclusion of a 52 | * special names table ('name') in font files. This table contains 53 | * textual (and internationalized) information regarding the font, like 54 | * family name, copyright, version, etc. 55 | * 56 | * The definitions below are used to access them if available. 57 | * 58 | * Note that this has nothing to do with glyph names! 59 | * 60 | */ 61 | 62 | 63 | /************************************************************************** 64 | * 65 | * @struct: 66 | * FT_SfntName 67 | * 68 | * @description: 69 | * A structure used to model an SFNT 'name' table entry. 70 | * 71 | * @fields: 72 | * platform_id :: 73 | * The platform ID for `string`. See @TT_PLATFORM_XXX for possible 74 | * values. 75 | * 76 | * encoding_id :: 77 | * The encoding ID for `string`. See @TT_APPLE_ID_XXX, @TT_MAC_ID_XXX, 78 | * @TT_ISO_ID_XXX, @TT_MS_ID_XXX, and @TT_ADOBE_ID_XXX for possible 79 | * values. 80 | * 81 | * language_id :: 82 | * The language ID for `string`. See @TT_MAC_LANGID_XXX and 83 | * @TT_MS_LANGID_XXX for possible values. 84 | * 85 | * Registered OpenType values for `language_id` are always smaller than 86 | * 0x8000; values equal or larger than 0x8000 usually indicate a 87 | * language tag string (introduced in OpenType version 1.6). Use 88 | * function @FT_Get_Sfnt_LangTag with `language_id` as its argument to 89 | * retrieve the associated language tag. 90 | * 91 | * name_id :: 92 | * An identifier for `string`. See @TT_NAME_ID_XXX for possible 93 | * values. 94 | * 95 | * string :: 96 | * The 'name' string. Note that its format differs depending on the 97 | * (platform,encoding) pair, being either a string of bytes (without a 98 | * terminating `NULL` byte) or containing UTF-16BE entities. 99 | * 100 | * string_len :: 101 | * The length of `string` in bytes. 102 | * 103 | * @note: 104 | * Please refer to the TrueType or OpenType specification for more 105 | * details. 106 | */ 107 | typedef struct FT_SfntName_ 108 | { 109 | FT_UShort platform_id; 110 | FT_UShort encoding_id; 111 | FT_UShort language_id; 112 | FT_UShort name_id; 113 | 114 | FT_Byte* string; /* this string is *not* null-terminated! */ 115 | FT_UInt string_len; /* in bytes */ 116 | 117 | } FT_SfntName; 118 | 119 | 120 | /************************************************************************** 121 | * 122 | * @function: 123 | * FT_Get_Sfnt_Name_Count 124 | * 125 | * @description: 126 | * Retrieve the number of name strings in the SFNT 'name' table. 127 | * 128 | * @input: 129 | * face :: 130 | * A handle to the source face. 131 | * 132 | * @return: 133 | * The number of strings in the 'name' table. 134 | * 135 | * @note: 136 | * This function always returns an error if the config macro 137 | * `TT_CONFIG_OPTION_SFNT_NAMES` is not defined in `ftoption.h`. 138 | */ 139 | FT_EXPORT( FT_UInt ) 140 | FT_Get_Sfnt_Name_Count( FT_Face face ); 141 | 142 | 143 | /************************************************************************** 144 | * 145 | * @function: 146 | * FT_Get_Sfnt_Name 147 | * 148 | * @description: 149 | * Retrieve a string of the SFNT 'name' table for a given index. 150 | * 151 | * @input: 152 | * face :: 153 | * A handle to the source face. 154 | * 155 | * idx :: 156 | * The index of the 'name' string. 157 | * 158 | * @output: 159 | * aname :: 160 | * The indexed @FT_SfntName structure. 161 | * 162 | * @return: 163 | * FreeType error code. 0~means success. 164 | * 165 | * @note: 166 | * The `string` array returned in the `aname` structure is not 167 | * null-terminated. Note that you don't have to deallocate `string` by 168 | * yourself; FreeType takes care of it if you call @FT_Done_Face. 169 | * 170 | * Use @FT_Get_Sfnt_Name_Count to get the total number of available 171 | * 'name' table entries, then do a loop until you get the right platform, 172 | * encoding, and name ID. 173 | * 174 | * 'name' table format~1 entries can use language tags also, see 175 | * @FT_Get_Sfnt_LangTag. 176 | * 177 | * This function always returns an error if the config macro 178 | * `TT_CONFIG_OPTION_SFNT_NAMES` is not defined in `ftoption.h`. 179 | */ 180 | FT_EXPORT( FT_Error ) 181 | FT_Get_Sfnt_Name( FT_Face face, 182 | FT_UInt idx, 183 | FT_SfntName *aname ); 184 | 185 | 186 | /************************************************************************** 187 | * 188 | * @struct: 189 | * FT_SfntLangTag 190 | * 191 | * @description: 192 | * A structure to model a language tag entry from an SFNT 'name' table. 193 | * 194 | * @fields: 195 | * string :: 196 | * The language tag string, encoded in UTF-16BE (without trailing 197 | * `NULL` bytes). 198 | * 199 | * string_len :: 200 | * The length of `string` in **bytes**. 201 | * 202 | * @note: 203 | * Please refer to the TrueType or OpenType specification for more 204 | * details. 205 | * 206 | * @since: 207 | * 2.8 208 | */ 209 | typedef struct FT_SfntLangTag_ 210 | { 211 | FT_Byte* string; /* this string is *not* null-terminated! */ 212 | FT_UInt string_len; /* in bytes */ 213 | 214 | } FT_SfntLangTag; 215 | 216 | 217 | /************************************************************************** 218 | * 219 | * @function: 220 | * FT_Get_Sfnt_LangTag 221 | * 222 | * @description: 223 | * Retrieve the language tag associated with a language ID of an SFNT 224 | * 'name' table entry. 225 | * 226 | * @input: 227 | * face :: 228 | * A handle to the source face. 229 | * 230 | * langID :: 231 | * The language ID, as returned by @FT_Get_Sfnt_Name. This is always a 232 | * value larger than 0x8000. 233 | * 234 | * @output: 235 | * alangTag :: 236 | * The language tag associated with the 'name' table entry's language 237 | * ID. 238 | * 239 | * @return: 240 | * FreeType error code. 0~means success. 241 | * 242 | * @note: 243 | * The `string` array returned in the `alangTag` structure is not 244 | * null-terminated. Note that you don't have to deallocate `string` by 245 | * yourself; FreeType takes care of it if you call @FT_Done_Face. 246 | * 247 | * Only 'name' table format~1 supports language tags. For format~0 248 | * tables, this function always returns FT_Err_Invalid_Table. For 249 | * invalid format~1 language ID values, FT_Err_Invalid_Argument is 250 | * returned. 251 | * 252 | * This function always returns an error if the config macro 253 | * `TT_CONFIG_OPTION_SFNT_NAMES` is not defined in `ftoption.h`. 254 | * 255 | * @since: 256 | * 2.8 257 | */ 258 | FT_EXPORT( FT_Error ) 259 | FT_Get_Sfnt_LangTag( FT_Face face, 260 | FT_UInt langID, 261 | FT_SfntLangTag *alangTag ); 262 | 263 | 264 | /* */ 265 | 266 | 267 | FT_END_HEADER 268 | 269 | #endif /* FTSNAMES_H_ */ 270 | 271 | 272 | /* END */ 273 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/ftsynth.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ftsynth.h 4 | * 5 | * FreeType synthesizing code for emboldening and slanting 6 | * (specification). 7 | * 8 | * Copyright (C) 2000-2024 by 9 | * David Turner, Robert Wilhelm, and Werner Lemberg. 10 | * 11 | * This file is part of the FreeType project, and may only be used, 12 | * modified, and distributed under the terms of the FreeType project 13 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 14 | * this file you indicate that you have read the license and 15 | * understand and accept it fully. 16 | * 17 | */ 18 | 19 | 20 | /*************************************************************************/ 21 | /*************************************************************************/ 22 | /*************************************************************************/ 23 | /*************************************************************************/ 24 | /*************************************************************************/ 25 | /********* *********/ 26 | /********* WARNING, THIS IS ALPHA CODE! THIS API *********/ 27 | /********* IS DUE TO CHANGE UNTIL STRICTLY NOTIFIED BY THE *********/ 28 | /********* FREETYPE DEVELOPMENT TEAM *********/ 29 | /********* *********/ 30 | /*************************************************************************/ 31 | /*************************************************************************/ 32 | /*************************************************************************/ 33 | /*************************************************************************/ 34 | /*************************************************************************/ 35 | 36 | 37 | /* Main reason for not lifting the functions in this module to a */ 38 | /* 'standard' API is that the used parameters for emboldening and */ 39 | /* slanting are not configurable. Consider the functions as a */ 40 | /* code resource that should be copied into the application and */ 41 | /* adapted to the particular needs. */ 42 | 43 | 44 | #ifndef FTSYNTH_H_ 45 | #define FTSYNTH_H_ 46 | 47 | 48 | #include 49 | 50 | #ifdef FREETYPE_H 51 | #error "freetype.h of FreeType 1 has been loaded!" 52 | #error "Please fix the directory search order for header files" 53 | #error "so that freetype.h of FreeType 2 is found first." 54 | #endif 55 | 56 | 57 | FT_BEGIN_HEADER 58 | 59 | /* Embolden a glyph by a 'reasonable' value (which is highly a matter of */ 60 | /* taste). This function is actually a convenience function, providing */ 61 | /* a wrapper for @FT_Outline_Embolden and @FT_Bitmap_Embolden. */ 62 | /* */ 63 | /* For emboldened outlines the height, width, and advance metrics are */ 64 | /* increased by the strength of the emboldening -- this even affects */ 65 | /* mono-width fonts! */ 66 | /* */ 67 | /* You can also call @FT_Outline_Get_CBox to get precise values. */ 68 | FT_EXPORT( void ) 69 | FT_GlyphSlot_Embolden( FT_GlyphSlot slot ); 70 | 71 | /* Precisely adjust the glyph weight either horizontally or vertically. */ 72 | /* The `xdelta` and `ydelta` values are fractions of the face Em size */ 73 | /* (in fixed-point format). Considering that a regular face would have */ 74 | /* stem widths on the order of 0.1 Em, a delta of 0.05 (0x0CCC) should */ 75 | /* be very noticeable. To increase or decrease the weight, use positive */ 76 | /* or negative values, respectively. */ 77 | FT_EXPORT( void ) 78 | FT_GlyphSlot_AdjustWeight( FT_GlyphSlot slot, 79 | FT_Fixed xdelta, 80 | FT_Fixed ydelta ); 81 | 82 | 83 | /* Slant an outline glyph to the right by about 12 degrees. */ 84 | FT_EXPORT( void ) 85 | FT_GlyphSlot_Oblique( FT_GlyphSlot slot ); 86 | 87 | /* Slant an outline glyph by a given sine of an angle. You can apply */ 88 | /* slant along either x- or y-axis by choosing a corresponding non-zero */ 89 | /* argument. If both slants are non-zero, some affine transformation */ 90 | /* will result. */ 91 | FT_EXPORT( void ) 92 | FT_GlyphSlot_Slant( FT_GlyphSlot slot, 93 | FT_Fixed xslant, 94 | FT_Fixed yslant ); 95 | 96 | /* */ 97 | 98 | 99 | FT_END_HEADER 100 | 101 | #endif /* FTSYNTH_H_ */ 102 | 103 | 104 | /* END */ 105 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/ftsystem.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ftsystem.h 4 | * 5 | * FreeType low-level system interface definition (specification). 6 | * 7 | * Copyright (C) 1996-2024 by 8 | * David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | 19 | #ifndef FTSYSTEM_H_ 20 | #define FTSYSTEM_H_ 21 | 22 | 23 | 24 | 25 | FT_BEGIN_HEADER 26 | 27 | 28 | /************************************************************************** 29 | * 30 | * @section: 31 | * system_interface 32 | * 33 | * @title: 34 | * System Interface 35 | * 36 | * @abstract: 37 | * How FreeType manages memory and i/o. 38 | * 39 | * @description: 40 | * This section contains various definitions related to memory management 41 | * and i/o access. You need to understand this information if you want to 42 | * use a custom memory manager or you own i/o streams. 43 | * 44 | */ 45 | 46 | 47 | /************************************************************************** 48 | * 49 | * M E M O R Y M A N A G E M E N T 50 | * 51 | */ 52 | 53 | 54 | /************************************************************************** 55 | * 56 | * @type: 57 | * FT_Memory 58 | * 59 | * @description: 60 | * A handle to a given memory manager object, defined with an 61 | * @FT_MemoryRec structure. 62 | * 63 | */ 64 | typedef struct FT_MemoryRec_* FT_Memory; 65 | 66 | 67 | /************************************************************************** 68 | * 69 | * @functype: 70 | * FT_Alloc_Func 71 | * 72 | * @description: 73 | * A function used to allocate `size` bytes from `memory`. 74 | * 75 | * @input: 76 | * memory :: 77 | * A handle to the source memory manager. 78 | * 79 | * size :: 80 | * The size in bytes to allocate. 81 | * 82 | * @return: 83 | * Address of new memory block. 0~in case of failure. 84 | * 85 | */ 86 | typedef void* 87 | (*FT_Alloc_Func)( FT_Memory memory, 88 | long size ); 89 | 90 | 91 | /************************************************************************** 92 | * 93 | * @functype: 94 | * FT_Free_Func 95 | * 96 | * @description: 97 | * A function used to release a given block of memory. 98 | * 99 | * @input: 100 | * memory :: 101 | * A handle to the source memory manager. 102 | * 103 | * block :: 104 | * The address of the target memory block. 105 | * 106 | */ 107 | typedef void 108 | (*FT_Free_Func)( FT_Memory memory, 109 | void* block ); 110 | 111 | 112 | /************************************************************************** 113 | * 114 | * @functype: 115 | * FT_Realloc_Func 116 | * 117 | * @description: 118 | * A function used to re-allocate a given block of memory. 119 | * 120 | * @input: 121 | * memory :: 122 | * A handle to the source memory manager. 123 | * 124 | * cur_size :: 125 | * The block's current size in bytes. 126 | * 127 | * new_size :: 128 | * The block's requested new size. 129 | * 130 | * block :: 131 | * The block's current address. 132 | * 133 | * @return: 134 | * New block address. 0~in case of memory shortage. 135 | * 136 | * @note: 137 | * In case of error, the old block must still be available. 138 | * 139 | */ 140 | typedef void* 141 | (*FT_Realloc_Func)( FT_Memory memory, 142 | long cur_size, 143 | long new_size, 144 | void* block ); 145 | 146 | 147 | /************************************************************************** 148 | * 149 | * @struct: 150 | * FT_MemoryRec 151 | * 152 | * @description: 153 | * A structure used to describe a given memory manager to FreeType~2. 154 | * 155 | * @fields: 156 | * user :: 157 | * A generic typeless pointer for user data. 158 | * 159 | * alloc :: 160 | * A pointer type to an allocation function. 161 | * 162 | * free :: 163 | * A pointer type to an memory freeing function. 164 | * 165 | * realloc :: 166 | * A pointer type to a reallocation function. 167 | * 168 | */ 169 | struct FT_MemoryRec_ 170 | { 171 | void* user; 172 | FT_Alloc_Func alloc; 173 | FT_Free_Func free; 174 | FT_Realloc_Func realloc; 175 | }; 176 | 177 | 178 | /************************************************************************** 179 | * 180 | * I / O M A N A G E M E N T 181 | * 182 | */ 183 | 184 | 185 | /************************************************************************** 186 | * 187 | * @type: 188 | * FT_Stream 189 | * 190 | * @description: 191 | * A handle to an input stream. 192 | * 193 | * @also: 194 | * See @FT_StreamRec for the publicly accessible fields of a given stream 195 | * object. 196 | * 197 | */ 198 | typedef struct FT_StreamRec_* FT_Stream; 199 | 200 | 201 | /************************************************************************** 202 | * 203 | * @struct: 204 | * FT_StreamDesc 205 | * 206 | * @description: 207 | * A union type used to store either a long or a pointer. This is used 208 | * to store a file descriptor or a `FILE*` in an input stream. 209 | * 210 | */ 211 | typedef union FT_StreamDesc_ 212 | { 213 | long value; 214 | void* pointer; 215 | 216 | } FT_StreamDesc; 217 | 218 | 219 | /************************************************************************** 220 | * 221 | * @functype: 222 | * FT_Stream_IoFunc 223 | * 224 | * @description: 225 | * A function used to seek and read data from a given input stream. 226 | * 227 | * @input: 228 | * stream :: 229 | * A handle to the source stream. 230 | * 231 | * offset :: 232 | * The offset from the start of the stream to seek to. 233 | * 234 | * buffer :: 235 | * The address of the read buffer. 236 | * 237 | * count :: 238 | * The number of bytes to read from the stream. 239 | * 240 | * @return: 241 | * If count >~0, return the number of bytes effectively read by the 242 | * stream (after seeking to `offset`). If count ==~0, return the status 243 | * of the seek operation (non-zero indicates an error). 244 | * 245 | */ 246 | typedef unsigned long 247 | (*FT_Stream_IoFunc)( FT_Stream stream, 248 | unsigned long offset, 249 | unsigned char* buffer, 250 | unsigned long count ); 251 | 252 | 253 | /************************************************************************** 254 | * 255 | * @functype: 256 | * FT_Stream_CloseFunc 257 | * 258 | * @description: 259 | * A function used to close a given input stream. 260 | * 261 | * @input: 262 | * stream :: 263 | * A handle to the target stream. 264 | * 265 | */ 266 | typedef void 267 | (*FT_Stream_CloseFunc)( FT_Stream stream ); 268 | 269 | 270 | /************************************************************************** 271 | * 272 | * @struct: 273 | * FT_StreamRec 274 | * 275 | * @description: 276 | * A structure used to describe an input stream. 277 | * 278 | * @input: 279 | * base :: 280 | * For memory-based streams, this is the address of the first stream 281 | * byte in memory. This field should always be set to `NULL` for 282 | * disk-based streams. 283 | * 284 | * size :: 285 | * The stream size in bytes. 286 | * 287 | * In case of compressed streams where the size is unknown before 288 | * actually doing the decompression, the value is set to 0x7FFFFFFF. 289 | * (Note that this size value can occur for normal streams also; it is 290 | * thus just a hint.) 291 | * 292 | * pos :: 293 | * The current position within the stream. 294 | * 295 | * descriptor :: 296 | * This field is a union that can hold an integer or a pointer. It is 297 | * used by stream implementations to store file descriptors or `FILE*` 298 | * pointers. 299 | * 300 | * pathname :: 301 | * This field is completely ignored by FreeType. However, it is often 302 | * useful during debugging to use it to store the stream's filename 303 | * (where available). 304 | * 305 | * read :: 306 | * The stream's input function. 307 | * 308 | * close :: 309 | * The stream's close function. 310 | * 311 | * memory :: 312 | * The memory manager to use to preload frames. This is set internally 313 | * by FreeType and shouldn't be touched by stream implementations. 314 | * 315 | * cursor :: 316 | * This field is set and used internally by FreeType when parsing 317 | * frames. In particular, the `FT_GET_XXX` macros use this instead of 318 | * the `pos` field. 319 | * 320 | * limit :: 321 | * This field is set and used internally by FreeType when parsing 322 | * frames. 323 | * 324 | */ 325 | typedef struct FT_StreamRec_ 326 | { 327 | unsigned char* base; 328 | unsigned long size; 329 | unsigned long pos; 330 | 331 | FT_StreamDesc descriptor; 332 | FT_StreamDesc pathname; 333 | FT_Stream_IoFunc read; 334 | FT_Stream_CloseFunc close; 335 | 336 | FT_Memory memory; 337 | unsigned char* cursor; 338 | unsigned char* limit; 339 | 340 | } FT_StreamRec; 341 | 342 | /* */ 343 | 344 | 345 | FT_END_HEADER 346 | 347 | #endif /* FTSYSTEM_H_ */ 348 | 349 | 350 | /* END */ 351 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/fttrigon.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * fttrigon.h 4 | * 5 | * FreeType trigonometric functions (specification). 6 | * 7 | * Copyright (C) 2001-2024 by 8 | * David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | 19 | #ifndef FTTRIGON_H_ 20 | #define FTTRIGON_H_ 21 | 22 | #include 23 | 24 | #ifdef FREETYPE_H 25 | #error "freetype.h of FreeType 1 has been loaded!" 26 | #error "Please fix the directory search order for header files" 27 | #error "so that freetype.h of FreeType 2 is found first." 28 | #endif 29 | 30 | 31 | FT_BEGIN_HEADER 32 | 33 | 34 | /************************************************************************** 35 | * 36 | * @section: 37 | * computations 38 | * 39 | */ 40 | 41 | 42 | /************************************************************************** 43 | * 44 | * @type: 45 | * FT_Angle 46 | * 47 | * @description: 48 | * This type is used to model angle values in FreeType. Note that the 49 | * angle is a 16.16 fixed-point value expressed in degrees. 50 | * 51 | */ 52 | typedef FT_Fixed FT_Angle; 53 | 54 | 55 | /************************************************************************** 56 | * 57 | * @macro: 58 | * FT_ANGLE_PI 59 | * 60 | * @description: 61 | * The angle pi expressed in @FT_Angle units. 62 | * 63 | */ 64 | #define FT_ANGLE_PI ( 180L << 16 ) 65 | 66 | 67 | /************************************************************************** 68 | * 69 | * @macro: 70 | * FT_ANGLE_2PI 71 | * 72 | * @description: 73 | * The angle 2*pi expressed in @FT_Angle units. 74 | * 75 | */ 76 | #define FT_ANGLE_2PI ( FT_ANGLE_PI * 2 ) 77 | 78 | 79 | /************************************************************************** 80 | * 81 | * @macro: 82 | * FT_ANGLE_PI2 83 | * 84 | * @description: 85 | * The angle pi/2 expressed in @FT_Angle units. 86 | * 87 | */ 88 | #define FT_ANGLE_PI2 ( FT_ANGLE_PI / 2 ) 89 | 90 | 91 | /************************************************************************** 92 | * 93 | * @macro: 94 | * FT_ANGLE_PI4 95 | * 96 | * @description: 97 | * The angle pi/4 expressed in @FT_Angle units. 98 | * 99 | */ 100 | #define FT_ANGLE_PI4 ( FT_ANGLE_PI / 4 ) 101 | 102 | 103 | /************************************************************************** 104 | * 105 | * @function: 106 | * FT_Sin 107 | * 108 | * @description: 109 | * Return the sinus of a given angle in fixed-point format. 110 | * 111 | * @input: 112 | * angle :: 113 | * The input angle. 114 | * 115 | * @return: 116 | * The sinus value. 117 | * 118 | * @note: 119 | * If you need both the sinus and cosinus for a given angle, use the 120 | * function @FT_Vector_Unit. 121 | * 122 | */ 123 | FT_EXPORT( FT_Fixed ) 124 | FT_Sin( FT_Angle angle ); 125 | 126 | 127 | /************************************************************************** 128 | * 129 | * @function: 130 | * FT_Cos 131 | * 132 | * @description: 133 | * Return the cosinus of a given angle in fixed-point format. 134 | * 135 | * @input: 136 | * angle :: 137 | * The input angle. 138 | * 139 | * @return: 140 | * The cosinus value. 141 | * 142 | * @note: 143 | * If you need both the sinus and cosinus for a given angle, use the 144 | * function @FT_Vector_Unit. 145 | * 146 | */ 147 | FT_EXPORT( FT_Fixed ) 148 | FT_Cos( FT_Angle angle ); 149 | 150 | 151 | /************************************************************************** 152 | * 153 | * @function: 154 | * FT_Tan 155 | * 156 | * @description: 157 | * Return the tangent of a given angle in fixed-point format. 158 | * 159 | * @input: 160 | * angle :: 161 | * The input angle. 162 | * 163 | * @return: 164 | * The tangent value. 165 | * 166 | */ 167 | FT_EXPORT( FT_Fixed ) 168 | FT_Tan( FT_Angle angle ); 169 | 170 | 171 | /************************************************************************** 172 | * 173 | * @function: 174 | * FT_Atan2 175 | * 176 | * @description: 177 | * Return the arc-tangent corresponding to a given vector (x,y) in the 2d 178 | * plane. 179 | * 180 | * @input: 181 | * x :: 182 | * The horizontal vector coordinate. 183 | * 184 | * y :: 185 | * The vertical vector coordinate. 186 | * 187 | * @return: 188 | * The arc-tangent value (i.e. angle). 189 | * 190 | */ 191 | FT_EXPORT( FT_Angle ) 192 | FT_Atan2( FT_Fixed x, 193 | FT_Fixed y ); 194 | 195 | 196 | /************************************************************************** 197 | * 198 | * @function: 199 | * FT_Angle_Diff 200 | * 201 | * @description: 202 | * Return the difference between two angles. The result is always 203 | * constrained to the ]-PI..PI] interval. 204 | * 205 | * @input: 206 | * angle1 :: 207 | * First angle. 208 | * 209 | * angle2 :: 210 | * Second angle. 211 | * 212 | * @return: 213 | * Constrained value of `angle2-angle1`. 214 | * 215 | */ 216 | FT_EXPORT( FT_Angle ) 217 | FT_Angle_Diff( FT_Angle angle1, 218 | FT_Angle angle2 ); 219 | 220 | 221 | /************************************************************************** 222 | * 223 | * @function: 224 | * FT_Vector_Unit 225 | * 226 | * @description: 227 | * Return the unit vector corresponding to a given angle. After the 228 | * call, the value of `vec.x` will be `cos(angle)`, and the value of 229 | * `vec.y` will be `sin(angle)`. 230 | * 231 | * This function is useful to retrieve both the sinus and cosinus of a 232 | * given angle quickly. 233 | * 234 | * @output: 235 | * vec :: 236 | * The address of target vector. 237 | * 238 | * @input: 239 | * angle :: 240 | * The input angle. 241 | * 242 | */ 243 | FT_EXPORT( void ) 244 | FT_Vector_Unit( FT_Vector* vec, 245 | FT_Angle angle ); 246 | 247 | 248 | /************************************************************************** 249 | * 250 | * @function: 251 | * FT_Vector_Rotate 252 | * 253 | * @description: 254 | * Rotate a vector by a given angle. 255 | * 256 | * @inout: 257 | * vec :: 258 | * The address of target vector. 259 | * 260 | * @input: 261 | * angle :: 262 | * The input angle. 263 | * 264 | */ 265 | FT_EXPORT( void ) 266 | FT_Vector_Rotate( FT_Vector* vec, 267 | FT_Angle angle ); 268 | 269 | 270 | /************************************************************************** 271 | * 272 | * @function: 273 | * FT_Vector_Length 274 | * 275 | * @description: 276 | * Return the length of a given vector. 277 | * 278 | * @input: 279 | * vec :: 280 | * The address of target vector. 281 | * 282 | * @return: 283 | * The vector length, expressed in the same units that the original 284 | * vector coordinates. 285 | * 286 | */ 287 | FT_EXPORT( FT_Fixed ) 288 | FT_Vector_Length( FT_Vector* vec ); 289 | 290 | 291 | /************************************************************************** 292 | * 293 | * @function: 294 | * FT_Vector_Polarize 295 | * 296 | * @description: 297 | * Compute both the length and angle of a given vector. 298 | * 299 | * @input: 300 | * vec :: 301 | * The address of source vector. 302 | * 303 | * @output: 304 | * length :: 305 | * The vector length. 306 | * 307 | * angle :: 308 | * The vector angle. 309 | * 310 | */ 311 | FT_EXPORT( void ) 312 | FT_Vector_Polarize( FT_Vector* vec, 313 | FT_Fixed *length, 314 | FT_Angle *angle ); 315 | 316 | 317 | /************************************************************************** 318 | * 319 | * @function: 320 | * FT_Vector_From_Polar 321 | * 322 | * @description: 323 | * Compute vector coordinates from a length and angle. 324 | * 325 | * @output: 326 | * vec :: 327 | * The address of source vector. 328 | * 329 | * @input: 330 | * length :: 331 | * The vector length. 332 | * 333 | * angle :: 334 | * The vector angle. 335 | * 336 | */ 337 | FT_EXPORT( void ) 338 | FT_Vector_From_Polar( FT_Vector* vec, 339 | FT_Fixed length, 340 | FT_Angle angle ); 341 | 342 | /* */ 343 | 344 | 345 | FT_END_HEADER 346 | 347 | #endif /* FTTRIGON_H_ */ 348 | 349 | 350 | /* END */ 351 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/ftwinfnt.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ftwinfnt.h 4 | * 5 | * FreeType API for accessing Windows fnt-specific data. 6 | * 7 | * Copyright (C) 2003-2024 by 8 | * David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | 19 | #ifndef FTWINFNT_H_ 20 | #define FTWINFNT_H_ 21 | 22 | #include 23 | 24 | #ifdef FREETYPE_H 25 | #error "freetype.h of FreeType 1 has been loaded!" 26 | #error "Please fix the directory search order for header files" 27 | #error "so that freetype.h of FreeType 2 is found first." 28 | #endif 29 | 30 | 31 | FT_BEGIN_HEADER 32 | 33 | 34 | /************************************************************************** 35 | * 36 | * @section: 37 | * winfnt_fonts 38 | * 39 | * @title: 40 | * Window FNT Files 41 | * 42 | * @abstract: 43 | * Windows FNT-specific API. 44 | * 45 | * @description: 46 | * This section contains the declaration of Windows FNT-specific 47 | * functions. 48 | * 49 | */ 50 | 51 | 52 | /************************************************************************** 53 | * 54 | * @enum: 55 | * FT_WinFNT_ID_XXX 56 | * 57 | * @description: 58 | * A list of valid values for the `charset` byte in @FT_WinFNT_HeaderRec. 59 | * Exact mapping tables for the various 'cpXXXX' encodings (except for 60 | * 'cp1361') can be found at 'ftp://ftp.unicode.org/Public/' in the 61 | * `MAPPINGS/VENDORS/MICSFT/WINDOWS` subdirectory. 'cp1361' is roughly a 62 | * superset of `MAPPINGS/OBSOLETE/EASTASIA/KSC/JOHAB.TXT`. 63 | * 64 | * @values: 65 | * FT_WinFNT_ID_DEFAULT :: 66 | * This is used for font enumeration and font creation as a 'don't 67 | * care' value. Valid font files don't contain this value. When 68 | * querying for information about the character set of the font that is 69 | * currently selected into a specified device context, this return 70 | * value (of the related Windows API) simply denotes failure. 71 | * 72 | * FT_WinFNT_ID_SYMBOL :: 73 | * There is no known mapping table available. 74 | * 75 | * FT_WinFNT_ID_MAC :: 76 | * Mac Roman encoding. 77 | * 78 | * FT_WinFNT_ID_OEM :: 79 | * From Michael Poettgen : 80 | * 81 | * The 'Windows Font Mapping' article says that `FT_WinFNT_ID_OEM` is 82 | * used for the charset of vector fonts, like `modern.fon`, 83 | * `roman.fon`, and `script.fon` on Windows. 84 | * 85 | * The 'CreateFont' documentation says: The `FT_WinFNT_ID_OEM` value 86 | * specifies a character set that is operating-system dependent. 87 | * 88 | * The 'IFIMETRICS' documentation from the 'Windows Driver Development 89 | * Kit' says: This font supports an OEM-specific character set. The 90 | * OEM character set is system dependent. 91 | * 92 | * In general OEM, as opposed to ANSI (i.e., 'cp1252'), denotes the 93 | * second default codepage that most international versions of Windows 94 | * have. It is one of the OEM codepages from 95 | * 96 | * https://docs.microsoft.com/en-us/windows/desktop/intl/code-page-identifiers 97 | * , 98 | * 99 | * and is used for the 'DOS boxes', to support legacy applications. A 100 | * German Windows version for example usually uses ANSI codepage 1252 101 | * and OEM codepage 850. 102 | * 103 | * FT_WinFNT_ID_CP874 :: 104 | * A superset of Thai TIS 620 and ISO 8859-11. 105 | * 106 | * FT_WinFNT_ID_CP932 :: 107 | * A superset of Japanese Shift-JIS (with minor deviations). 108 | * 109 | * FT_WinFNT_ID_CP936 :: 110 | * A superset of simplified Chinese GB 2312-1980 (with different 111 | * ordering and minor deviations). 112 | * 113 | * FT_WinFNT_ID_CP949 :: 114 | * A superset of Korean Hangul KS~C 5601-1987 (with different ordering 115 | * and minor deviations). 116 | * 117 | * FT_WinFNT_ID_CP950 :: 118 | * A superset of traditional Chinese Big~5 ETen (with different 119 | * ordering and minor deviations). 120 | * 121 | * FT_WinFNT_ID_CP1250 :: 122 | * A superset of East European ISO 8859-2 (with slightly different 123 | * ordering). 124 | * 125 | * FT_WinFNT_ID_CP1251 :: 126 | * A superset of Russian ISO 8859-5 (with different ordering). 127 | * 128 | * FT_WinFNT_ID_CP1252 :: 129 | * ANSI encoding. A superset of ISO 8859-1. 130 | * 131 | * FT_WinFNT_ID_CP1253 :: 132 | * A superset of Greek ISO 8859-7 (with minor modifications). 133 | * 134 | * FT_WinFNT_ID_CP1254 :: 135 | * A superset of Turkish ISO 8859-9. 136 | * 137 | * FT_WinFNT_ID_CP1255 :: 138 | * A superset of Hebrew ISO 8859-8 (with some modifications). 139 | * 140 | * FT_WinFNT_ID_CP1256 :: 141 | * A superset of Arabic ISO 8859-6 (with different ordering). 142 | * 143 | * FT_WinFNT_ID_CP1257 :: 144 | * A superset of Baltic ISO 8859-13 (with some deviations). 145 | * 146 | * FT_WinFNT_ID_CP1258 :: 147 | * For Vietnamese. This encoding doesn't cover all necessary 148 | * characters. 149 | * 150 | * FT_WinFNT_ID_CP1361 :: 151 | * Korean (Johab). 152 | */ 153 | 154 | #define FT_WinFNT_ID_CP1252 0 155 | #define FT_WinFNT_ID_DEFAULT 1 156 | #define FT_WinFNT_ID_SYMBOL 2 157 | #define FT_WinFNT_ID_MAC 77 158 | #define FT_WinFNT_ID_CP932 128 159 | #define FT_WinFNT_ID_CP949 129 160 | #define FT_WinFNT_ID_CP1361 130 161 | #define FT_WinFNT_ID_CP936 134 162 | #define FT_WinFNT_ID_CP950 136 163 | #define FT_WinFNT_ID_CP1253 161 164 | #define FT_WinFNT_ID_CP1254 162 165 | #define FT_WinFNT_ID_CP1258 163 166 | #define FT_WinFNT_ID_CP1255 177 167 | #define FT_WinFNT_ID_CP1256 178 168 | #define FT_WinFNT_ID_CP1257 186 169 | #define FT_WinFNT_ID_CP1251 204 170 | #define FT_WinFNT_ID_CP874 222 171 | #define FT_WinFNT_ID_CP1250 238 172 | #define FT_WinFNT_ID_OEM 255 173 | 174 | 175 | /************************************************************************** 176 | * 177 | * @struct: 178 | * FT_WinFNT_HeaderRec 179 | * 180 | * @description: 181 | * Windows FNT Header info. 182 | */ 183 | typedef struct FT_WinFNT_HeaderRec_ 184 | { 185 | FT_UShort version; 186 | FT_ULong file_size; 187 | FT_Byte copyright[60]; 188 | FT_UShort file_type; 189 | FT_UShort nominal_point_size; 190 | FT_UShort vertical_resolution; 191 | FT_UShort horizontal_resolution; 192 | FT_UShort ascent; 193 | FT_UShort internal_leading; 194 | FT_UShort external_leading; 195 | FT_Byte italic; 196 | FT_Byte underline; 197 | FT_Byte strike_out; 198 | FT_UShort weight; 199 | FT_Byte charset; 200 | FT_UShort pixel_width; 201 | FT_UShort pixel_height; 202 | FT_Byte pitch_and_family; 203 | FT_UShort avg_width; 204 | FT_UShort max_width; 205 | FT_Byte first_char; 206 | FT_Byte last_char; 207 | FT_Byte default_char; 208 | FT_Byte break_char; 209 | FT_UShort bytes_per_row; 210 | FT_ULong device_offset; 211 | FT_ULong face_name_offset; 212 | FT_ULong bits_pointer; 213 | FT_ULong bits_offset; 214 | FT_Byte reserved; 215 | FT_ULong flags; 216 | FT_UShort A_space; 217 | FT_UShort B_space; 218 | FT_UShort C_space; 219 | FT_UShort color_table_offset; 220 | FT_ULong reserved1[4]; 221 | 222 | } FT_WinFNT_HeaderRec; 223 | 224 | 225 | /************************************************************************** 226 | * 227 | * @struct: 228 | * FT_WinFNT_Header 229 | * 230 | * @description: 231 | * A handle to an @FT_WinFNT_HeaderRec structure. 232 | */ 233 | typedef struct FT_WinFNT_HeaderRec_* FT_WinFNT_Header; 234 | 235 | 236 | /************************************************************************** 237 | * 238 | * @function: 239 | * FT_Get_WinFNT_Header 240 | * 241 | * @description: 242 | * Retrieve a Windows FNT font info header. 243 | * 244 | * @input: 245 | * face :: 246 | * A handle to the input face. 247 | * 248 | * @output: 249 | * aheader :: 250 | * The WinFNT header. 251 | * 252 | * @return: 253 | * FreeType error code. 0~means success. 254 | * 255 | * @note: 256 | * This function only works with Windows FNT faces, returning an error 257 | * otherwise. 258 | */ 259 | FT_EXPORT( FT_Error ) 260 | FT_Get_WinFNT_Header( FT_Face face, 261 | FT_WinFNT_HeaderRec *aheader ); 262 | 263 | /* */ 264 | 265 | 266 | FT_END_HEADER 267 | 268 | #endif /* FTWINFNT_H_ */ 269 | 270 | 271 | /* END */ 272 | 273 | 274 | /* Local Variables: */ 275 | /* coding: utf-8 */ 276 | /* End: */ 277 | -------------------------------------------------------------------------------- /examples/inc/freetype2/freetype/tttags.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * tttags.h 4 | * 5 | * Tags for TrueType and OpenType tables (specification only). 6 | * 7 | * Copyright (C) 1996-2024 by 8 | * David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | 19 | #ifndef TTAGS_H_ 20 | #define TTAGS_H_ 21 | 22 | 23 | #include 24 | 25 | #ifdef FREETYPE_H 26 | #error "freetype.h of FreeType 1 has been loaded!" 27 | #error "Please fix the directory search order for header files" 28 | #error "so that freetype.h of FreeType 2 is found first." 29 | #endif 30 | 31 | 32 | FT_BEGIN_HEADER 33 | 34 | 35 | #define TTAG_avar FT_MAKE_TAG( 'a', 'v', 'a', 'r' ) 36 | #define TTAG_BASE FT_MAKE_TAG( 'B', 'A', 'S', 'E' ) 37 | #define TTAG_bdat FT_MAKE_TAG( 'b', 'd', 'a', 't' ) 38 | #define TTAG_BDF FT_MAKE_TAG( 'B', 'D', 'F', ' ' ) 39 | #define TTAG_bhed FT_MAKE_TAG( 'b', 'h', 'e', 'd' ) 40 | #define TTAG_bloc FT_MAKE_TAG( 'b', 'l', 'o', 'c' ) 41 | #define TTAG_bsln FT_MAKE_TAG( 'b', 's', 'l', 'n' ) 42 | #define TTAG_CBDT FT_MAKE_TAG( 'C', 'B', 'D', 'T' ) 43 | #define TTAG_CBLC FT_MAKE_TAG( 'C', 'B', 'L', 'C' ) 44 | #define TTAG_CFF FT_MAKE_TAG( 'C', 'F', 'F', ' ' ) 45 | #define TTAG_CFF2 FT_MAKE_TAG( 'C', 'F', 'F', '2' ) 46 | #define TTAG_CID FT_MAKE_TAG( 'C', 'I', 'D', ' ' ) 47 | #define TTAG_cmap FT_MAKE_TAG( 'c', 'm', 'a', 'p' ) 48 | #define TTAG_COLR FT_MAKE_TAG( 'C', 'O', 'L', 'R' ) 49 | #define TTAG_CPAL FT_MAKE_TAG( 'C', 'P', 'A', 'L' ) 50 | #define TTAG_cvar FT_MAKE_TAG( 'c', 'v', 'a', 'r' ) 51 | #define TTAG_cvt FT_MAKE_TAG( 'c', 'v', 't', ' ' ) 52 | #define TTAG_DSIG FT_MAKE_TAG( 'D', 'S', 'I', 'G' ) 53 | #define TTAG_EBDT FT_MAKE_TAG( 'E', 'B', 'D', 'T' ) 54 | #define TTAG_EBLC FT_MAKE_TAG( 'E', 'B', 'L', 'C' ) 55 | #define TTAG_EBSC FT_MAKE_TAG( 'E', 'B', 'S', 'C' ) 56 | #define TTAG_feat FT_MAKE_TAG( 'f', 'e', 'a', 't' ) 57 | #define TTAG_FOND FT_MAKE_TAG( 'F', 'O', 'N', 'D' ) 58 | #define TTAG_fpgm FT_MAKE_TAG( 'f', 'p', 'g', 'm' ) 59 | #define TTAG_fvar FT_MAKE_TAG( 'f', 'v', 'a', 'r' ) 60 | #define TTAG_gasp FT_MAKE_TAG( 'g', 'a', 's', 'p' ) 61 | #define TTAG_GDEF FT_MAKE_TAG( 'G', 'D', 'E', 'F' ) 62 | #define TTAG_glyf FT_MAKE_TAG( 'g', 'l', 'y', 'f' ) 63 | #define TTAG_GPOS FT_MAKE_TAG( 'G', 'P', 'O', 'S' ) 64 | #define TTAG_GSUB FT_MAKE_TAG( 'G', 'S', 'U', 'B' ) 65 | #define TTAG_gvar FT_MAKE_TAG( 'g', 'v', 'a', 'r' ) 66 | #define TTAG_HVAR FT_MAKE_TAG( 'H', 'V', 'A', 'R' ) 67 | #define TTAG_hdmx FT_MAKE_TAG( 'h', 'd', 'm', 'x' ) 68 | #define TTAG_head FT_MAKE_TAG( 'h', 'e', 'a', 'd' ) 69 | #define TTAG_hhea FT_MAKE_TAG( 'h', 'h', 'e', 'a' ) 70 | #define TTAG_hmtx FT_MAKE_TAG( 'h', 'm', 't', 'x' ) 71 | #define TTAG_JSTF FT_MAKE_TAG( 'J', 'S', 'T', 'F' ) 72 | #define TTAG_just FT_MAKE_TAG( 'j', 'u', 's', 't' ) 73 | #define TTAG_kern FT_MAKE_TAG( 'k', 'e', 'r', 'n' ) 74 | #define TTAG_lcar FT_MAKE_TAG( 'l', 'c', 'a', 'r' ) 75 | #define TTAG_loca FT_MAKE_TAG( 'l', 'o', 'c', 'a' ) 76 | #define TTAG_LTSH FT_MAKE_TAG( 'L', 'T', 'S', 'H' ) 77 | #define TTAG_LWFN FT_MAKE_TAG( 'L', 'W', 'F', 'N' ) 78 | #define TTAG_MATH FT_MAKE_TAG( 'M', 'A', 'T', 'H' ) 79 | #define TTAG_maxp FT_MAKE_TAG( 'm', 'a', 'x', 'p' ) 80 | #define TTAG_META FT_MAKE_TAG( 'M', 'E', 'T', 'A' ) 81 | #define TTAG_MMFX FT_MAKE_TAG( 'M', 'M', 'F', 'X' ) 82 | #define TTAG_MMSD FT_MAKE_TAG( 'M', 'M', 'S', 'D' ) 83 | #define TTAG_mort FT_MAKE_TAG( 'm', 'o', 'r', 't' ) 84 | #define TTAG_morx FT_MAKE_TAG( 'm', 'o', 'r', 'x' ) 85 | #define TTAG_MVAR FT_MAKE_TAG( 'M', 'V', 'A', 'R' ) 86 | #define TTAG_name FT_MAKE_TAG( 'n', 'a', 'm', 'e' ) 87 | #define TTAG_opbd FT_MAKE_TAG( 'o', 'p', 'b', 'd' ) 88 | #define TTAG_OS2 FT_MAKE_TAG( 'O', 'S', '/', '2' ) 89 | #define TTAG_OTTO FT_MAKE_TAG( 'O', 'T', 'T', 'O' ) 90 | #define TTAG_PCLT FT_MAKE_TAG( 'P', 'C', 'L', 'T' ) 91 | #define TTAG_POST FT_MAKE_TAG( 'P', 'O', 'S', 'T' ) 92 | #define TTAG_post FT_MAKE_TAG( 'p', 'o', 's', 't' ) 93 | #define TTAG_prep FT_MAKE_TAG( 'p', 'r', 'e', 'p' ) 94 | #define TTAG_prop FT_MAKE_TAG( 'p', 'r', 'o', 'p' ) 95 | #define TTAG_sbix FT_MAKE_TAG( 's', 'b', 'i', 'x' ) 96 | #define TTAG_sfnt FT_MAKE_TAG( 's', 'f', 'n', 't' ) 97 | #define TTAG_SING FT_MAKE_TAG( 'S', 'I', 'N', 'G' ) 98 | #define TTAG_SVG FT_MAKE_TAG( 'S', 'V', 'G', ' ' ) 99 | #define TTAG_trak FT_MAKE_TAG( 't', 'r', 'a', 'k' ) 100 | #define TTAG_true FT_MAKE_TAG( 't', 'r', 'u', 'e' ) 101 | #define TTAG_ttc FT_MAKE_TAG( 't', 't', 'c', ' ' ) 102 | #define TTAG_ttcf FT_MAKE_TAG( 't', 't', 'c', 'f' ) 103 | #define TTAG_TYP1 FT_MAKE_TAG( 'T', 'Y', 'P', '1' ) 104 | #define TTAG_typ1 FT_MAKE_TAG( 't', 'y', 'p', '1' ) 105 | #define TTAG_VDMX FT_MAKE_TAG( 'V', 'D', 'M', 'X' ) 106 | #define TTAG_vhea FT_MAKE_TAG( 'v', 'h', 'e', 'a' ) 107 | #define TTAG_vmtx FT_MAKE_TAG( 'v', 'm', 't', 'x' ) 108 | #define TTAG_VVAR FT_MAKE_TAG( 'V', 'V', 'A', 'R' ) 109 | #define TTAG_wOFF FT_MAKE_TAG( 'w', 'O', 'F', 'F' ) 110 | #define TTAG_wOF2 FT_MAKE_TAG( 'w', 'O', 'F', '2' ) 111 | 112 | /* used by "Keyboard.dfont" on legacy Mac OS X */ 113 | #define TTAG_0xA5kbd FT_MAKE_TAG( 0xA5, 'k', 'b', 'd' ) 114 | 115 | /* used by "LastResort.dfont" on legacy Mac OS X */ 116 | #define TTAG_0xA5lst FT_MAKE_TAG( 0xA5, 'l', 's', 't' ) 117 | 118 | 119 | FT_END_HEADER 120 | 121 | #endif /* TTAGS_H_ */ 122 | 123 | 124 | /* END */ 125 | -------------------------------------------------------------------------------- /examples/inc/freetype2/ft2build.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * ft2build.h 4 | * 5 | * FreeType 2 build and setup macros. 6 | * 7 | * Copyright (C) 1996-2024 by 8 | * David Turner, Robert Wilhelm, and Werner Lemberg. 9 | * 10 | * This file is part of the FreeType project, and may only be used, 11 | * modified, and distributed under the terms of the FreeType project 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 | * this file you indicate that you have read the license and 14 | * understand and accept it fully. 15 | * 16 | */ 17 | 18 | 19 | /************************************************************************** 20 | * 21 | * This is the 'entry point' for FreeType header file inclusions, to be 22 | * loaded before all other header files. 23 | * 24 | * A typical example is 25 | * 26 | * ``` 27 | * #include 28 | * #include 29 | * ``` 30 | * 31 | */ 32 | 33 | 34 | #ifndef FT2BUILD_H_ 35 | #define FT2BUILD_H_ 36 | 37 | #include 38 | 39 | #endif /* FT2BUILD_H_ */ 40 | 41 | 42 | /* END */ 43 | -------------------------------------------------------------------------------- /examples/inc/imgui/imgui_impl_glfw.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Backend for GLFW 2 | // This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan, WebGPU..) 3 | // (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.) 4 | 5 | // Implemented features: 6 | // [X] Platform: Clipboard support. 7 | // [X] Platform: Mouse support. Can discriminate Mouse/TouchScreen/Pen (Windows only). 8 | // [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy GLFW_KEY_* values are obsolete since 1.87 and not supported since 1.91.5] 9 | // [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 10 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange' (note: the resizing cursors requires GLFW 3.4+). 11 | 12 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 13 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 14 | // Learn about Dear ImGui: 15 | // - FAQ https://dearimgui.com/faq 16 | // - Getting Started https://dearimgui.com/getting-started 17 | // - Documentation https://dearimgui.com/docs (same as your local docs/ folder). 18 | // - Introduction, links and more at the top of imgui.cpp 19 | 20 | #pragma once 21 | #include "imgui.h" // IMGUI_IMPL_API 22 | #ifndef IMGUI_DISABLE 23 | 24 | struct GLFWwindow; 25 | struct GLFWmonitor; 26 | 27 | // Follow "Getting Started" link and check examples/ folder to learn about using backends! 28 | IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks); 29 | IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForVulkan(GLFWwindow* window, bool install_callbacks); 30 | IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOther(GLFWwindow* window, bool install_callbacks); 31 | IMGUI_IMPL_API void ImGui_ImplGlfw_Shutdown(); 32 | IMGUI_IMPL_API void ImGui_ImplGlfw_NewFrame(); 33 | 34 | // Emscripten related initialization phase methods (call after ImGui_ImplGlfw_InitForOpenGL) 35 | #ifdef __EMSCRIPTEN__ 36 | IMGUI_IMPL_API void ImGui_ImplGlfw_InstallEmscriptenCallbacks(GLFWwindow* window, const char* canvas_selector); 37 | //static inline void ImGui_ImplGlfw_InstallEmscriptenCanvasResizeCallback(const char* canvas_selector) { ImGui_ImplGlfw_InstallEmscriptenCallbacks(nullptr, canvas_selector); } } // Renamed in 1.91.0 38 | #endif 39 | 40 | // GLFW callbacks install 41 | // - When calling Init with 'install_callbacks=true': ImGui_ImplGlfw_InstallCallbacks() is called. GLFW callbacks will be installed for you. They will chain-call user's previously installed callbacks, if any. 42 | // - When calling Init with 'install_callbacks=false': GLFW callbacks won't be installed. You will need to call individual function yourself from your own GLFW callbacks. 43 | IMGUI_IMPL_API void ImGui_ImplGlfw_InstallCallbacks(GLFWwindow* window); 44 | IMGUI_IMPL_API void ImGui_ImplGlfw_RestoreCallbacks(GLFWwindow* window); 45 | 46 | // GFLW callbacks options: 47 | // - Set 'chain_for_all_windows=true' to enable chaining callbacks for all windows (including secondary viewports created by backends or by user) 48 | IMGUI_IMPL_API void ImGui_ImplGlfw_SetCallbacksChainForAllWindows(bool chain_for_all_windows); 49 | 50 | // GLFW callbacks (individual callbacks to call yourself if you didn't install callbacks) 51 | IMGUI_IMPL_API void ImGui_ImplGlfw_WindowFocusCallback(GLFWwindow* window, int focused); // Since 1.84 52 | IMGUI_IMPL_API void ImGui_ImplGlfw_CursorEnterCallback(GLFWwindow* window, int entered); // Since 1.84 53 | IMGUI_IMPL_API void ImGui_ImplGlfw_CursorPosCallback(GLFWwindow* window, double x, double y); // Since 1.87 54 | IMGUI_IMPL_API void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods); 55 | IMGUI_IMPL_API void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset); 56 | IMGUI_IMPL_API void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods); 57 | IMGUI_IMPL_API void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c); 58 | IMGUI_IMPL_API void ImGui_ImplGlfw_MonitorCallback(GLFWmonitor* monitor, int event); 59 | 60 | // GLFW helpers 61 | IMGUI_IMPL_API void ImGui_ImplGlfw_Sleep(int milliseconds); 62 | 63 | #endif // #ifndef IMGUI_DISABLE 64 | -------------------------------------------------------------------------------- /examples/inc/imgui/imgui_impl_opengl3.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer Backend for modern OpenGL with shaders / programmatic pipeline 2 | // - Desktop GL: 2.x 3.x 4.x 3 | // - Embedded GL: ES 2.0 (WebGL 1.0), ES 3.0 (WebGL 2.0) 4 | // This needs to be used along with a Platform Backend (e.g. GLFW, SDL, Win32, custom..) 5 | 6 | // Implemented features: 7 | // [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID! 8 | // [x] Renderer: Large meshes support (64k+ vertices) with 16-bit indices (Desktop OpenGL only). 9 | 10 | // About WebGL/ES: 11 | // - You need to '#define IMGUI_IMPL_OPENGL_ES2' or '#define IMGUI_IMPL_OPENGL_ES3' to use WebGL or OpenGL ES. 12 | // - This is done automatically on iOS, Android and Emscripten targets. 13 | // - For other targets, the define needs to be visible from the imgui_impl_opengl3.cpp compilation unit. If unsure, define globally or in imconfig.h. 14 | 15 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 16 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 17 | // Learn about Dear ImGui: 18 | // - FAQ https://dearimgui.com/faq 19 | // - Getting Started https://dearimgui.com/getting-started 20 | // - Documentation https://dearimgui.com/docs (same as your local docs/ folder). 21 | // - Introduction, links and more at the top of imgui.cpp 22 | 23 | // About GLSL version: 24 | // The 'glsl_version' initialization parameter should be nullptr (default) or a "#version XXX" string. 25 | // On computer platform the GLSL version default to "#version 130". On OpenGL ES 3 platform it defaults to "#version 300 es" 26 | // Only override if your GL version doesn't handle this GLSL version. See GLSL version table at the top of imgui_impl_opengl3.cpp. 27 | 28 | #pragma once 29 | #include "imgui.h" // IMGUI_IMPL_API 30 | #ifndef IMGUI_DISABLE 31 | 32 | // Follow "Getting Started" link and check examples/ folder to learn about using backends! 33 | IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = nullptr); 34 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_Shutdown(); 35 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_NewFrame(); 36 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data); 37 | 38 | // (Optional) Called by Init/NewFrame/Shutdown 39 | IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateFontsTexture(); 40 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyFontsTexture(); 41 | IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateDeviceObjects(); 42 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyDeviceObjects(); 43 | 44 | // Configuration flags to add in your imconfig file: 45 | //#define IMGUI_IMPL_OPENGL_ES2 // Enable ES 2 (Auto-detected on Emscripten) 46 | //#define IMGUI_IMPL_OPENGL_ES3 // Enable ES 3 (Auto-detected on iOS/Android) 47 | 48 | // You can explicitly select GLES2 or GLES3 API by using one of the '#define IMGUI_IMPL_OPENGL_LOADER_XXX' in imconfig.h or compiler command-line. 49 | #if !defined(IMGUI_IMPL_OPENGL_ES2) \ 50 | && !defined(IMGUI_IMPL_OPENGL_ES3) 51 | 52 | // Try to detect GLES on matching platforms 53 | #if defined(__APPLE__) 54 | #include 55 | #endif 56 | #if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV)) || (defined(__ANDROID__)) 57 | #define IMGUI_IMPL_OPENGL_ES3 // iOS, Android -> GL ES 3, "#version 300 es" 58 | #elif defined(__EMSCRIPTEN__) || defined(__amigaos4__) 59 | #define IMGUI_IMPL_OPENGL_ES2 // Emscripten -> GL ES 2, "#version 100" 60 | #else 61 | // Otherwise imgui_impl_opengl3_loader.h will be used. 62 | #endif 63 | 64 | #endif 65 | 66 | #endif // #ifndef IMGUI_DISABLE 67 | -------------------------------------------------------------------------------- /examples/inc/imgui/misc/freetype/imgui_freetype.h: -------------------------------------------------------------------------------- 1 | // dear imgui: FreeType font builder (used as a replacement for the stb_truetype builder) 2 | // (headers) 3 | 4 | #pragma once 5 | #include "imgui.h" // IMGUI_API 6 | #ifndef IMGUI_DISABLE 7 | 8 | // Usage: 9 | // - Add '#define IMGUI_ENABLE_FREETYPE' in your imconfig to enable support for imgui_freetype in imgui. 10 | 11 | // Optional support for OpenType SVG fonts: 12 | // - Add '#define IMGUI_ENABLE_FREETYPE_PLUTOSVG' to use plutosvg (not provided). See #7927. 13 | // - Add '#define IMGUI_ENABLE_FREETYPE_LUNASVG' to use lunasvg (not provided). See #6591. 14 | 15 | // Forward declarations 16 | struct ImFontAtlas; 17 | struct ImFontBuilderIO; 18 | 19 | // Hinting greatly impacts visuals (and glyph sizes). 20 | // - By default, hinting is enabled and the font's native hinter is preferred over the auto-hinter. 21 | // - When disabled, FreeType generates blurrier glyphs, more or less matches the stb_truetype.h 22 | // - The Default hinting mode usually looks good, but may distort glyphs in an unusual way. 23 | // - The Light hinting mode generates fuzzier glyphs but better matches Microsoft's rasterizer. 24 | // You can set those flags globaly in ImFontAtlas::FontBuilderFlags 25 | // You can set those flags on a per font basis in ImFontConfig::FontBuilderFlags 26 | enum ImGuiFreeTypeBuilderFlags 27 | { 28 | ImGuiFreeTypeBuilderFlags_NoHinting = 1 << 0, // Disable hinting. This generally generates 'blurrier' bitmap glyphs when the glyph are rendered in any of the anti-aliased modes. 29 | ImGuiFreeTypeBuilderFlags_NoAutoHint = 1 << 1, // Disable auto-hinter. 30 | ImGuiFreeTypeBuilderFlags_ForceAutoHint = 1 << 2, // Indicates that the auto-hinter is preferred over the font's native hinter. 31 | ImGuiFreeTypeBuilderFlags_LightHinting = 1 << 3, // A lighter hinting algorithm for gray-level modes. Many generated glyphs are fuzzier but better resemble their original shape. This is achieved by snapping glyphs to the pixel grid only vertically (Y-axis), as is done by Microsoft's ClearType and Adobe's proprietary font renderer. This preserves inter-glyph spacing in horizontal text. 32 | ImGuiFreeTypeBuilderFlags_MonoHinting = 1 << 4, // Strong hinting algorithm that should only be used for monochrome output. 33 | ImGuiFreeTypeBuilderFlags_Bold = 1 << 5, // Styling: Should we artificially embolden the font? 34 | ImGuiFreeTypeBuilderFlags_Oblique = 1 << 6, // Styling: Should we slant the font, emulating italic style? 35 | ImGuiFreeTypeBuilderFlags_Monochrome = 1 << 7, // Disable anti-aliasing. Combine this with MonoHinting for best results! 36 | ImGuiFreeTypeBuilderFlags_LoadColor = 1 << 8, // Enable FreeType color-layered glyphs 37 | ImGuiFreeTypeBuilderFlags_Bitmap = 1 << 9 // Enable FreeType bitmap glyphs 38 | }; 39 | 40 | namespace ImGuiFreeType 41 | { 42 | // This is automatically assigned when using '#define IMGUI_ENABLE_FREETYPE'. 43 | // If you need to dynamically select between multiple builders: 44 | // - you can manually assign this builder with 'atlas->FontBuilderIO = ImGuiFreeType::GetBuilderForFreeType()' 45 | // - prefer deep-copying this into your own ImFontBuilderIO instance if you use hot-reloading that messes up static data. 46 | IMGUI_API const ImFontBuilderIO* GetBuilderForFreeType(); 47 | 48 | // Override allocators. By default ImGuiFreeType will use IM_ALLOC()/IM_FREE() 49 | // However, as FreeType does lots of allocations we provide a way for the user to redirect it to a separate memory heap if desired. 50 | IMGUI_API void SetAllocatorFunctions(void* (*alloc_func)(size_t sz, void* user_data), void (*free_func)(void* ptr, void* user_data), void* user_data = nullptr); 51 | 52 | // Obsolete names (will be removed soon) 53 | #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS 54 | //static inline bool BuildFontAtlas(ImFontAtlas* atlas, unsigned int flags = 0) { atlas->FontBuilderIO = GetBuilderForFreeType(); atlas->FontBuilderFlags = flags; return atlas->Build(); } // Prefer using '#define IMGUI_ENABLE_FREETYPE' 55 | #endif 56 | } 57 | 58 | #endif // #ifndef IMGUI_DISABLE 59 | -------------------------------------------------------------------------------- /examples/lib/blend2d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajax-crypto/ImRichText/b738f78fe78a9420b079d5c4b7f871c17c900771/examples/lib/blend2d.lib -------------------------------------------------------------------------------- /examples/lib/freetype.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajax-crypto/ImRichText/b738f78fe78a9420b079d5c4b7f871c17c900771/examples/lib/freetype.lib -------------------------------------------------------------------------------- /examples/lib/glfw3_mt.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajax-crypto/ImRichText/b738f78fe78a9420b079d5c4b7f871c17c900771/examples/lib/glfw3_mt.lib -------------------------------------------------------------------------------- /examples/win32/imrichtext_demo/glfwgl3/imrichtext_demo.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 17.0 23 | Win32Proj 24 | {89d44b06-3a7e-4f94-addc-f11bbd45b437} 25 | imrichtextdemo 26 | 10.0 27 | 28 | 29 | 30 | Application 31 | true 32 | v143 33 | Unicode 34 | 35 | 36 | Application 37 | false 38 | v143 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | true 45 | v143 46 | Unicode 47 | 48 | 49 | Application 50 | false 51 | v143 52 | true 53 | Unicode 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | ..\..\..\inc\freetype2;..\..\..\inc\blend2d;..\..\..\inc\GLFW;..\..\..\inc\imgui;..\..\..\inc;$(IncludePath) 75 | ..\..\..\lib;$(LibraryPath) 76 | ..\..\..\src;$(SourcePath) 77 | 78 | 79 | ..\..\..\inc\freetype2;..\..\..\inc\blend2d;..\..\..\inc\GLFW;..\..\..\inc\imgui;..\..\..\inc;$(IncludePath) 80 | ..\..\..\lib;$(LibraryPath) 81 | ..\..\..\src;$(SourcePath) 82 | 83 | 84 | 85 | Level3 86 | true 87 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 88 | true 89 | 90 | 91 | Console 92 | true 93 | 94 | 95 | 96 | 97 | Level3 98 | true 99 | true 100 | true 101 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 102 | true 103 | 104 | 105 | Console 106 | true 107 | true 108 | true 109 | 110 | 111 | 112 | 113 | Level2 114 | true 115 | _DEBUG;_CONSOLE;IM_RICHTEXT_TARGET_IMGUI;%(PreprocessorDefinitions) 116 | true 117 | stdcpp17 118 | false 119 | 120 | 121 | Console 122 | true 123 | freetype.lib;glfw3_mt.lib;blend2d.lib;opengl32.lib;%(AdditionalDependencies) 124 | /NODEFAULTLIB:library %(AdditionalOptions) 125 | 126 | 127 | 128 | 129 | Level2 130 | true 131 | true 132 | true 133 | NDEBUG;_CONSOLE;IM_RICHTEXT_TARGET_IMGUI;%(PreprocessorDefinitions) 134 | true 135 | stdcpp17 136 | false 137 | true 138 | Sync 139 | AdvancedVectorExtensions2 140 | Fast 141 | false 142 | false 143 | AnySuitable 144 | Speed 145 | true 146 | false 147 | false 148 | 149 | 150 | Windows 151 | true 152 | true 153 | true 154 | freetype.lib;glfw3_mt.lib;blend2d.lib;opengl32.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) 155 | LinkVerboseLib 156 | true 157 | /NODEFAULTLIB:library /SUBSYSTEM:WINDOWS %(AdditionalOptions) 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | -------------------------------------------------------------------------------- /examples/win32/imrichtext_demo/glfwgl3/imrichtext_demo.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {f16407f9-e417-4631-97d8-fa1948860af4} 18 | 19 | 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files\imguil_lib 26 | 27 | 28 | Source Files\imguil_lib 29 | 30 | 31 | Source Files\imguil_lib 32 | 33 | 34 | Source Files\imguil_lib 35 | 36 | 37 | Source Files\imguil_lib 38 | 39 | 40 | Source Files\imguil_lib 41 | 42 | 43 | Source Files\imguil_lib 44 | 45 | 46 | Source Files 47 | 48 | 49 | Source Files 50 | 51 | 52 | Source Files 53 | 54 | 55 | Source Files 56 | 57 | 58 | Source Files\imguil_lib 59 | 60 | 61 | 62 | 63 | Header Files 64 | 65 | 66 | Header Files 67 | 68 | 69 | Header Files 70 | 71 | 72 | Header Files 73 | 74 | 75 | 76 | 77 | Resource Files 78 | 79 | 80 | -------------------------------------------------------------------------------- /examples/win32/imrichtext_demo/glfwgl3/imrichtext_demo.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /examples/win32/imrichtext_demo/imrichtext_demo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.12.35728.132 d17.12 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "imrichtext_demo", "glfwgl3\imrichtext_demo.vcxproj", "{89D44B06-3A7E-4F94-ADDC-F11BBD45B437}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {89D44B06-3A7E-4F94-ADDC-F11BBD45B437}.Debug|x64.ActiveCfg = Debug|x64 17 | {89D44B06-3A7E-4F94-ADDC-F11BBD45B437}.Debug|x64.Build.0 = Debug|x64 18 | {89D44B06-3A7E-4F94-ADDC-F11BBD45B437}.Debug|x86.ActiveCfg = Debug|Win32 19 | {89D44B06-3A7E-4F94-ADDC-F11BBD45B437}.Debug|x86.Build.0 = Debug|Win32 20 | {89D44B06-3A7E-4F94-ADDC-F11BBD45B437}.Release|x64.ActiveCfg = Release|x64 21 | {89D44B06-3A7E-4F94-ADDC-F11BBD45B437}.Release|x64.Build.0 = Release|x64 22 | {89D44B06-3A7E-4F94-ADDC-F11BBD45B437}.Release|x86.ActiveCfg = Release|Win32 23 | {89D44B06-3A7E-4F94-ADDC-F11BBD45B437}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /imrichtextfont.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | /* 8 | This file is optional, provides a default cached 9 | font loading/caching mechanism that is used by the 10 | library. It is not mandatory to include this file 11 | in your project, if you are implementing your own 12 | IRenderer interface. 13 | 14 | NOTE: For ImGui integration, this font loader supports 15 | both STB and FreeType based backends present in 16 | ImGui library. SVG Font based ones are not yet 17 | supported. 18 | */ 19 | 20 | #ifndef IM_FONTMANAGER_STANDALONE 21 | namespace ImRichText 22 | #else 23 | namespace ImFontManager 24 | #endif 25 | { 26 | enum FontType 27 | { 28 | FT_Normal, FT_Light, FT_Bold, FT_Italics, FT_BoldItalics, FT_Total 29 | }; 30 | 31 | // Determines which UTF-8 characters are present in provided rich text 32 | // NOTE: Irrespective of the enum value, text is expected to be UTF-8 encoded 33 | enum class TextContentCharset 34 | { 35 | ASCII, // Standard ASCII characters (0-127) 36 | ASCIISymbols, // Extended ASCII + certain common characters i.e. math symbols, arrows, ™, etc. 37 | UTF8Simple, // Simple UTF8 encoded text without support for GPOS/kerning/ligatures (libgrapheme) 38 | UnicodeBidir // Standard compliant Unicode BiDir algorithm implementation (Harfbuzz) 39 | }; 40 | 41 | struct FontCollectionFile 42 | { 43 | std::string_view Files[FT_Total]; 44 | }; 45 | 46 | struct FontFileNames 47 | { 48 | FontCollectionFile Proportional; 49 | FontCollectionFile Monospace; 50 | std::string_view BasePath; 51 | }; 52 | 53 | struct RenderConfig; 54 | 55 | enum FontLoadType : uint64_t 56 | { 57 | FLT_Proportional = 1, 58 | FLT_Monospace = 2, 59 | 60 | FLT_HasSmall = 4, 61 | FLT_HasSuperscript = 8, 62 | FLT_HasSubscript = 16, 63 | FLT_HasH1 = 32, 64 | FLT_HasH2 = 64, 65 | FLT_HasH3 = 128, 66 | FLT_HasH4 = 256, 67 | FLT_HasH5 = 512, 68 | FLT_HasH6 = 1024, 69 | 70 | // Use this to auto-scale fonts, loading the largest size for a family 71 | // NOTE: For ImGui backend, this will save on memory from texture 72 | FLT_AutoScale = 2048, 73 | 74 | // Include all tags 75 | FLT_HasHeaders = FLT_HasH1 | FLT_HasH2 | FLT_HasH3 | FLT_HasH4 | FLT_HasH5 | FLT_HasH6, 76 | 77 | // TODO: Handle absolute size font-size fonts (Look at imrichtext.cpp: PopulateSegmentStyle function) 78 | }; 79 | 80 | struct FontDescriptor 81 | { 82 | std::optional names = std::nullopt; 83 | std::vector sizes; 84 | TextContentCharset charset = TextContentCharset::ASCII; 85 | uint64_t flags = FLT_Proportional; 86 | }; 87 | 88 | #ifndef IM_FONTMANAGER_STANDALONE 89 | // Get font sizes required from the specified config and flt 90 | // flt is a bitwise OR of FontLoadType flags 91 | std::vector GetFontSizes(const RenderConfig& config, uint64_t flt); 92 | #endif 93 | 94 | // Load default fonts based on provided descriptor. Custom paths can also be 95 | // specified through FontDescriptor::names member. If not specified, a OS specific 96 | // default path is selected i.e. C:\Windows\Fonts for Windows and 97 | // /usr/share/fonts/ for Linux. 98 | bool LoadDefaultFonts(const FontDescriptor* descriptors, int totalNames = 1); 99 | 100 | #ifndef IM_FONTMANAGER_STANDALONE 101 | // Load default fonts from specified config, bitwise OR of FontLoadType flags, 102 | // and provided charset which determines which glyph ranges to load 103 | bool LoadDefaultFonts(const RenderConfig& config, uint64_t flt, TextContentCharset charset); 104 | #endif 105 | 106 | // Find out path to .ttf file for specified font family and font type 107 | // The exact filepath returned is based on reading TTF OS/2 and name tables 108 | // The matching is done on best effort basis. 109 | // NOTE: This is not a replacement of fontconfig library and can only perform 110 | // rudimentary font fallback 111 | [[nodiscard]] std::string_view FindFontFile(std::string_view family, FontType ft, 112 | std::string_view* lookupPaths = nullptr, int lookupSz = 0); 113 | 114 | #ifdef IM_RICHTEXT_TARGET_IMGUI 115 | // Get the closest matching font based on provided parameters. The return type is 116 | // ImFont* cast to void* to better fit overall library. 117 | // NOTE: size matching happens with lower_bound calls, this is done because all fonts 118 | // should be preloaded for ImGui, dynamic font atlas updates are not supported. 119 | [[nodiscard]] void* GetFont(std::string_view family, float size, FontType type); 120 | 121 | #ifndef IM_FONTMANAGER_STANDALONE 122 | // Get font to display overlay i.e. style info in side panel 123 | [[nodiscard]] void* GetOverlayFont(const RenderConfig& config); 124 | #endif 125 | 126 | // Return status of font atlas construction 127 | [[nodiscard]] bool IsFontLoaded(); 128 | #endif 129 | #ifdef IM_RICHTEXT_TARGET_BLEND2D 130 | using FontFamilyToFileMapper = std::string_view(*)(std::string_view); 131 | struct FontExtraInfo { FontFamilyToFileMapper mapper = nullptr; std::string_view filepath; }; 132 | 133 | // Preload font lookup info which is used in FindFontFile and GetFont function to perform 134 | // fast lookup + rudimentary fallback. 135 | void PreloadFontLookupInfo(int timeoutMs); 136 | 137 | // Get the closest matching font based on provided parameters. The return type is 138 | // BLFont* cast to void* to better fit overall library. 139 | // NOTE: The FontExtraInfo::mapper can be assigned to a function which loads fonts based 140 | // con content codepoints and can perform better fallback. 141 | [[nodiscard]] void* GetFont(std::string_view family, float size, FontType type, FontExtraInfo extra); 142 | #endif 143 | } 144 | -------------------------------------------------------------------------------- /imrichtextimpl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef IM_RICHTEXT_TARGET_IMGUI 4 | #include "imgui_internal.h" 5 | #endif 6 | #ifdef IM_RICHTEXT_TARGET_BLEND2D 7 | #include 8 | #endif 9 | #include "imrichtextutils.h" 10 | 11 | namespace ImRichText 12 | { 13 | struct RenderConfig; 14 | 15 | struct ASCIITextShaper final : public ITextShaper 16 | { 17 | [[nodiscard]] static ASCIITextShaper* Instance(); 18 | 19 | void ShapeText(float availwidth, const Span& words, 20 | StyleAccessor accessor, LineRecorder lineRecorder, WordRecorder wordRecorder, 21 | const RenderConfig& config, void* userdata); 22 | void SegmentText(std::string_view content, WhitespaceCollapseBehavior wsbhv, 23 | LineRecorder lineRecorder, WordRecorder wordRecorder, const RenderConfig& config, 24 | bool ignoreLineBreaks, bool ignoreEscapeCodes, void* userdata); 25 | 26 | [[nodiscard]] int NextGraphemeCluster(const char* from, const char* end) const; // Dummy impl for ASCII, unused 27 | [[nodiscard]] int NextWordBreak(const char* from, const char* end) const; // Dummy impl for ASCII, unused 28 | [[nodiscard]] int NextLineBreak(const char* from, const char* end) const; // Dummy impl for ASCII, unused 29 | 30 | static const std::pair EscapeCodes[6]; 31 | }; 32 | 33 | struct ASCIISymbolTextShaper final : public ITextShaper 34 | { 35 | [[nodiscard]] static ASCIISymbolTextShaper* Instance(); 36 | 37 | void ShapeText(float availwidth, const Span& words, 38 | StyleAccessor accessor, LineRecorder lineRecorder, WordRecorder wordRecorder, 39 | const RenderConfig& config, void* userdata); 40 | void SegmentText(std::string_view content, WhitespaceCollapseBehavior wsbhv, 41 | LineRecorder lineRecorder, WordRecorder wordRecorder, const RenderConfig& config, 42 | bool ignoreLineBreaks, bool ignoreEscapeCodes, void* userdata); 43 | 44 | [[nodiscard]] int NextGraphemeCluster(const char* from, const char* end) const; 45 | [[nodiscard]] int NextWordBreak(const char* from, const char* end) const; 46 | [[nodiscard]] int NextLineBreak(const char* from, const char* end) const; 47 | 48 | static const std::pair EscapeCodes[11]; 49 | }; 50 | 51 | #ifdef IM_RICHTEXT_TARGET_IMGUI 52 | 53 | struct ImGuiRenderer final : public IRenderer 54 | { 55 | RenderConfig& config; 56 | 57 | ImGuiRenderer(RenderConfig&); 58 | 59 | void SetClipRect(ImVec2 startpos, ImVec2 endpos); 60 | void ResetClipRect(); 61 | 62 | void DrawLine(ImVec2 startpos, ImVec2 endpos, uint32_t color, float thickness = 1.f); 63 | void DrawPolyline(ImVec2* points, int sz, uint32_t color, float thickness); 64 | void DrawTriangle(ImVec2 pos1, ImVec2 pos2, ImVec2 pos3, uint32_t color, bool filled, bool thickness = 1.f); 65 | void DrawRect(ImVec2 startpos, ImVec2 endpos, uint32_t color, bool filled, float thickness = 1.f); 66 | void DrawRoundedRect(ImVec2 startpos, ImVec2 endpos, uint32_t color, bool filled, float topleftr, float toprightr, float bottomrightr, float bottomleftr, float thickness = 1.f); 67 | void DrawRectGradient(ImVec2 startpos, ImVec2 endpos, uint32_t topleftcolor, uint32_t toprightcolor, uint32_t bottomrightcolor, uint32_t bottomleftcolor); 68 | void DrawPolygon(ImVec2* points, int sz, uint32_t color, bool filled, float thickness = 1.f); 69 | void DrawPolyGradient(ImVec2* points, uint32_t* colors, int sz); 70 | void DrawCircle(ImVec2 center, float radius, uint32_t color, bool filled, bool thickness = 1.f); 71 | void DrawRadialGradient(ImVec2 center, float radius, uint32_t in, uint32_t out, int start, int end); 72 | 73 | bool SetCurrentFont(std::string_view family, float sz, FontType type) override; 74 | bool SetCurrentFont(void* fontptr, float sz) override; 75 | void ResetFont() override; 76 | [[nodiscard]] ImVec2 GetTextSize(std::string_view text, void* fontptr, float sz); 77 | void DrawText(std::string_view text, ImVec2 pos, uint32_t color); 78 | void DrawText(std::string_view text, std::string_view family, ImVec2 pos, float sz, uint32_t color, FontType type); 79 | void DrawTooltip(ImVec2 pos, std::string_view text); 80 | [[nodiscard]] float EllipsisWidth(void* fontptr, float sz) override; 81 | 82 | private: 83 | 84 | float _currentFontSz = 0.f; 85 | }; 86 | 87 | struct ImGuiPlatform final : public IPlatform 88 | { 89 | void (*HyperlinkClicked)(std::string_view); 90 | 91 | ImGuiPlatform(void (*hc)(std::string_view) = nullptr) 92 | : HyperlinkClicked(hc) {} 93 | 94 | ImVec2 GetCurrentMousePos(); 95 | bool IsMouseClicked(); 96 | void HandleHyperlink(std::string_view); 97 | void RequestFrame() {} 98 | void HandleHover(bool hovered); 99 | }; 100 | 101 | #endif 102 | #ifdef IM_RICHTEXT_TARGET_BLEND2D 103 | 104 | struct Blend2DRenderer final : public IRenderer 105 | { 106 | BLContext& context; 107 | BLFont* currentFont = nullptr; 108 | 109 | Blend2DRenderer(BLContext& ctx); 110 | 111 | void SetClipRect(ImVec2 startpos, ImVec2 endpos); 112 | void ResetClipRect(); 113 | 114 | void DrawLine(ImVec2 startpos, ImVec2 endpos, uint32_t color, float thickness = 1.f); 115 | void DrawPolyline(ImVec2* points, int sz, uint32_t color, float thickness); 116 | void DrawTriangle(ImVec2 pos1, ImVec2 pos2, ImVec2 pos3, uint32_t color, bool filled, bool thickness = 1.f); 117 | void DrawRect(ImVec2 startpos, ImVec2 endpos, uint32_t color, bool filled, float thickness = 1.f); 118 | void DrawRectGradient(ImVec2 startpos, ImVec2 endpos, uint32_t topleftcolor, uint32_t toprightcolor, uint32_t bottomrightcolor, uint32_t bottomleftcolor); 119 | void DrawRoundedRect(ImVec2 startpos, ImVec2 endpos, uint32_t color, bool filled, float topleftr, float toprightr, float bottomrightr, float bottomleftr, float thickness = 1.f); 120 | void DrawPolygon(ImVec2* points, int sz, uint32_t color, bool filled, float thickness = 1.f); 121 | void DrawPolyGradient(ImVec2* points, uint32_t* colors, int sz); 122 | void DrawCircle(ImVec2 center, float radius, uint32_t color, bool filled, bool thickness = 1.f); 123 | void DrawRadialGradient(ImVec2 center, float radius, uint32_t in, uint32_t out, int start, int end); 124 | 125 | bool SetCurrentFont(std::string_view family, float sz, FontType type) override; 126 | bool SetCurrentFont(void* fontptr, float sz) override; 127 | void ResetFont() override; 128 | ImVec2 GetTextSize(std::string_view text, void* fontptr, float sz); 129 | void DrawText(std::string_view text, ImVec2 pos, uint32_t color); 130 | void DrawText(std::string_view text, std::string_view family, ImVec2 pos, float sz, uint32_t color, FontType type); 131 | void DrawTooltip(ImVec2 pos, std::string_view text); 132 | }; 133 | 134 | #endif 135 | } 136 | -------------------------------------------------------------------------------- /screenshots/basic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajax-crypto/ImRichText/b738f78fe78a9420b079d5c4b7f871c17c900771/screenshots/basic.png -------------------------------------------------------------------------------- /screenshots/imrichtext.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajax-crypto/ImRichText/b738f78fe78a9420b079d5c4b7f871c17c900771/screenshots/imrichtext.gif --------------------------------------------------------------------------------