Skip to content

Instantly share code, notes, and snippets.

@k4b7
Created June 24, 2015 04:57
Show Gist options
  • Select an option

  • Save k4b7/fa5e9ed342c928a0f31f to your computer and use it in GitHub Desktop.

Select an option

Save k4b7/fa5e9ed342c928a0f31f to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdbool.h>
#include <ft2build.h>
#include FT_FREETYPE_H
FT_Library library;
FT_Face face;
FT_Error error;
int main(void) {
FT_Init_FreeType(&library);
FT_New_Face(library, "KaTeX_Main-Regular.ttf", 0, &face);
int code_point;
FT_UInt index;
code_point = 0x22a5; // up tack
index = FT_Get_Char_Index(face, code_point);
printf("%x: %u\n", code_point, index);
code_point = 0x27c2; // perpendicular
index = FT_Get_Char_Index(face, code_point);
printf("%x: %u\n", code_point, index);
}
@k4b7
Copy link
Author

k4b7 commented Jun 24, 2015

output:

22a5: 247
27c2: 0

The glyph index. 0 means ‘undefined character code’.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment