aadded FontInfo.h

This commit is contained in:
HuYingzhuo(hugo/hyzboy) 2023-06-15 11:21:25 +08:00
parent be17b06a2f
commit 03f9f83920
2 changed files with 57 additions and 0 deletions

56
inc/hgl/text/FontInfo.h Normal file
View File

@ -0,0 +1,56 @@
#pragma once
#include<hgl/type/Map.h>
namespace hgl
{
enum class FontType
{
Raster,
Vector,
TrueType
};
constexpr const size_t HGL_FONT_NAME_MAX_LENGTH=128;
struct FontInfo
{
os_char name[HGL_FONT_NAME_MAX_LENGTH];
FontType type;
uint charset;
//尺寸仅用于Raster字体
uint height;
uint ascent; ///<上升
uint descent; ///<下降
uint internal_leading; ///<内部行距
uint external_leading; ///<外部行距
uint ave_char_width; ///<平均字宽
uint max_char_width; ///<最大字宽
uint weight; ///<权重
uint overhang; ///<超出部分
uint digitized_aspect_x; ///<横向分辨率
uint digitized_aspect_y; ///<纵向分辨率
os_char first_char;
os_char last_char;
os_char default_char;
os_char break_char;
bool italic; ///<斜体
bool underlined; ///<下划线
bool struck_out; ///<删除线
uint pitch_and_family; ///<字体类型
public:
FontInfo()
{
hgl_zero(*this);
}
};
using FontMap=ObjectMap<OSString,FontInfo>;
void EnumOSFonts(FontMap *);
}//namespace hgl

View File

@ -66,6 +66,7 @@ SET(STRING_HEADER_FILES ${TYPE_INCLUDE_PATH}/String.h
SET(TEXT_HEADER_FILES ${CMCORE_ROOT_INCLUDE_PATH}/hgl/Endian.h
${CMCORE_ROOT_INCLUDE_PATH}/hgl/CodePage.h
${CMCORE_ROOT_INCLUDE_PATH}/hgl/text/FontInfo.h
${TYPE_INCLUDE_PATH}/UnicodeBlocks.h
${TYPE_INCLUDE_PATH}/StrChar.h)