c - libRocket 需要哪些 FreeType2 库模块?

标签 c opengl open-source freetype librocket

libRocket HTML/CSS UI 生成器依赖于 FreeType2 库。但是,FreeType2 包含许多可选模块,可以在编译时将其禁用。

最小化分布式二进制文件的大小对于移动平台尤为重要。

libRocket 依赖于哪些 FreeType2 模块?可以安全地禁用哪些模块?

最佳答案

librocket 的源代码目录中“GREPing”任何以 FT_ 开头的东西都会产生:

Core/FontDatabase.cpp   |33  col 10| #include FT_FREETYPE_H
Core/FontDatabase.cpp   |43  col 8 | static FT_Library ft_library = NULL;
Core/FontDatabase.cpp   |63  col 3 | FT_Error result = FT_Init_FreeType(&ft_library);
Core/FontDatabase.cpp   |63  col 21| FT_Error result = FT_Init_FreeType(&ft_library);
Core/FontDatabase.cpp   |84  col 4 | FT_Done_FreeType(ft_library);
Core/FontDatabase.cpp   |95  col 2 | FT_Face ft_face = (FT_Face) instance->LoadFace(file_name);
Core/FontDatabase.cpp   |95  col 21| FT_Face ft_face = (FT_Face) instance->LoadFace(file_name);
Core/FontDatabase.cpp   |102 col 45| Font::Style style = ft_face->style_flags & FT_STYLE_FLAG_ITALIC ? Font::STYLE_ITALIC : Font::STYLE_NORMAL;
Core/FontDatabase.cpp   |103 col 47| Font::Weight weight = ft_face->style_flags & FT_STYLE_FLAG_BOLD ? Font::WEIGHT_BOLD : Font::WEIGHT_NORMAL;
Core/FontDatabase.cpp   |120 col 2 | FT_Face ft_face = (FT_Face) instance->LoadFace(file_name);
Core/FontDatabase.cpp   |120 col 21| FT_Face ft_face = (FT_Face) instance->LoadFace(file_name);
Core/FontDatabase.cpp   |142 col 2 | FT_Face ft_face = (FT_Face) instance->LoadFace(data, data_length, "memory", false);
Core/FontDatabase.cpp   |142 col 21| FT_Face ft_face = (FT_Face) instance->LoadFace(data, data_length, "memory", false);
Core/FontDatabase.cpp   |149 col 45| Font::Style style = ft_face->style_flags & FT_STYLE_FLAG_ITALIC ? Font::STYLE_ITALIC : Font::STYLE_NORMAL;
Core/FontDatabase.cpp   |150 col 47| Font::Weight weight = ft_face->style_flags & FT_STYLE_FLAG_BOLD ? Font::WEIGHT_BOLD : Font::WEIGHT_NORMAL;
Core/FontDatabase.cpp   |167 col 2 | FT_Face ft_face = (FT_Face) instance->LoadFace(data, data_length, "memory", false);
Core/FontDatabase.cpp   |167 col 21| FT_Face ft_face = (FT_Face) instance->LoadFace(data, data_length, "memory", false);
Core/FontDatabase.cpp   |271 col 31| return font_family->AddFace((FT_Face) face, style, weight, release_stream);
Core/FontDatabase.cpp   |287 col 2 | FT_Byte* buffer = new FT_Byte[length];
Core/FontDatabase.cpp   |287 col 24| FT_Byte* buffer = new FT_Byte[length];
Core/FontDatabase.cpp   |297 col 2 | FT_Face face = NULL;
Core/FontDatabase.cpp   |298 col 14| int error = FT_New_Memory_Face(ft_library, (const FT_Byte*) data, data_length, 0, &face);
Core/FontDatabase.cpp   |298 col 52| int error = FT_New_Memory_Face(ft_library, (const FT_Byte*) data, data_length, 0, &face);
Core/FontDatabase.cpp   |311 col 3 | FT_Select_Charmap(face, FT_ENCODING_APPLE_ROMAN);
Core/FontDatabase.cpp   |311 col 27| FT_Select_Charmap(face, FT_ENCODING_APPLE_ROMAN);
Core/FontDatabase.cpp   |315 col 4 | FT_Done_Face(face);
Core/FontFace.cpp       |36  col 20| FontFace::FontFace(FT_Face _face, Font::Style _style, Font::Weight _weight, bool _release_stream)
Core/FontFace.cpp       |149 col 3 | FT_Byte* face_memory = face->stream->base;
Core/FontFace.cpp       |150 col 3 | FT_Done_Face(face);
Core/FontFaceHandle.cpp |71  col 33| bool FontFaceHandle::Initialise(FT_Face ft_face, const String& _charset, int _size)
Core/FontFaceHandle.cpp |83  col 2 | FT_Error error = FT_Set_Char_Size(ft_face, 0, size << 6, 0, 0);
Core/FontFaceHandle.cpp |83  col 19| FT_Error error = FT_Set_Char_Size(ft_face, 0, size << 6, 0, 0);
Core/FontFaceHandle.cpp |356 col 38| void FontFaceHandle::GenerateMetrics(FT_Face ft_face)
Core/FontFaceHandle.cpp |361 col 23| underline_position = FT_MulFix(ft_face->underline_position, ft_face->size->metrics.y_scale) / float(1 << 6);
Core/FontFaceHandle.cpp |362 col 24| underline_thickness = FT_MulFix(ft_face->underline_thickness, ft_face->size->metrics.y_scale) / float(1 << 6);
Core/FontFaceHandle.cpp |382 col 14| int index = FT_Get_Char_Index(ft_face, x);
Core/FontFaceHandle.cpp |383 col 6 | if (FT_Load_Glyph(ft_face, index, 0) == 0)
Core/FontFaceHandle.cpp |389 col 36| void FontFaceHandle::BuildGlyphMap(FT_Face ft_face, const UnicodeRange& unicode_range)
Core/FontFaceHandle.cpp |394 col 15| int index = FT_Get_Char_Index(ft_face, character_code);
Core/FontFaceHandle.cpp |397 col 4 | FT_Error error = FT_Load_Glyph(ft_face, index, 0);
Core/FontFaceHandle.cpp |397 col 21| FT_Error error = FT_Load_Glyph(ft_face, index, 0);
Core/FontFaceHandle.cpp |405 col 12| error = FT_Render_Glyph(ft_face->glyph, FT_RENDER_MODE_NORMAL);
Core/FontFaceHandle.cpp |405 col 44| error = FT_Render_Glyph(ft_face->glyph, FT_RENDER_MODE_NORMAL);
Core/FontFaceHandle.cpp |421 col 51| void FontFaceHandle::BuildGlyph(FontGlyph& glyph, FT_GlyphSlot ft_glyph)
Core/FontFaceHandle.cpp |442 col 38| if (ft_glyph->bitmap.pixel_mode != FT_PIXEL_MODE_MONO &&
Core/FontFaceHandle.cpp |443 col 35| ft_glyph->bitmap.pixel_mode != FT_PIXEL_MODE_GRAY)
Core/FontFaceHandle.cpp |460 col 10| case FT_PIXEL_MODE_MONO:
Core/FontFaceHandle.cpp |488 col 10| case FT_PIXEL_MODE_GRAY:
Core/FontFaceHandle.cpp |505 col 35| void FontFaceHandle::BuildKerning(FT_Face ft_face)
Core/FontFaceHandle.cpp |508 col 6 | if (FT_HAS_KERNING(ft_face))
Core/FontFaceHandle.cpp |522 col 7 | FT_Vector ft_kerning;
Core/FontFaceHandle.cpp |523 col 7 | FT_Get_Kerning(ft_face, FT_Get_Char_Index(ft_face, lhs), FT_Get_Char_Index(ft_face, rhs), FT_KERNING_DEFAULT, &ft_kerning);
Core/FontFaceHandle.cpp |523 col 31| FT_Get_Kerning(ft_face, FT_Get_Char_Index(ft_face, lhs), FT_Get_Char_Index(ft_face, rhs), FT_KERNING_DEFAULT, &ft_kerning);
Core/FontFaceHandle.cpp |523 col 64| FT_Get_Kerning(ft_face, FT_Get_Char_Index(ft_face, lhs), FT_Get_Char_Index(ft_face, rhs), FT_KERNING_DEFAULT, &ft_kerning);
Core/FontFaceHandle.cpp |523 col 97| FT_Get_Kerning(ft_face, FT_Get_Char_Index(ft_face, lhs), FT_Get_Char_Index(ft_face, rhs), FT_KERNING_DEFAULT, &ft_kerning);
Core/FontFamily.cpp     |46  col 26| bool FontFamily::AddFace(FT_Face ft_face, Font::Style style, Font::Weight weight, bool release_stream)
Core/FontFace.h         |33  col 10| #include FT_FREETYPE_H
Core/FontFace.h         |48  col 11| FontFace(FT_Face face, Font::Style style, Font::Weight weight, bool release_stream);
Core/FontFace.h         |71  col 2 | FT_Face face;
Core/FontFaceHandle.h   |40  col 10| #include FT_FREETYPE_H
Core/FontFaceHandle.h   |63  col 18| bool Initialise(FT_Face ft_face, const String& charset, int size);
Core/FontFaceHandle.h   |138 col 23| void GenerateMetrics(FT_Face ft_face);
Core/FontFaceHandle.h   |140 col 21| void BuildGlyphMap(FT_Face ft_face, const UnicodeRange& unicode_range);
Core/FontFaceHandle.h   |141 col 36| void BuildGlyph(FontGlyph& glyph, FT_GlyphSlot ft_glyph);
Core/FontFaceHandle.h   |143 col 20| void BuildKerning(FT_Face ft_face);
Core/FontFamily.h       |33  col 10| #include FT_FREETYPE_H
Core/FontFamily.h       |57  col 15| bool AddFace(FT_Face ft_face, Font::Style style, Font::Weight weight, bool release_stream);

快速浏览一下我已经封装了这些函数的列表:

FT_Init_FreeType
FT_Done_FreeType
FT_New_Memory_Face
FT_Done_Face
FT_Select_Charmap
FT_Set_Char_Size
FT_MulFix
FT_Get_Char_Index
FT_Load_Glyph
FT_Render_Glyph
FT_Get_Kerning

我对 Freetype 的了解不够,无法告诉您这些函数属于哪些模块,但我认为您可以从 documentation 中找出答案。 .

关于c - libRocket 需要哪些 FreeType2 库模块?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24014016/

相关文章:

c++ - 此像素着色器中的漫反射和镜面反射

java - 条纹中的开源 CMS?

linux - 无法重新打开 DSP 设备/dev/dsp : Permission denied

c - C 中使用的括号,不带 if、循环等控制结构

c - PPM interups 的 Softserial.println 减慢循环

java - 仅在负轴上法线贴图 "working"

c++ - OpenGL着色器输入

java - 一个优秀的Java开源项目版本控制、项目管理和托管团队

c - 如何在不转到下一行的情况下读取 C 中的 char 值

c - 在结构体中声明结构体