Skip to content

Commit

Permalink
完善点阵位置
Browse files Browse the repository at this point in the history
  • Loading branch information
HEYAHONG committed Dec 13, 2024
1 parent b825e75 commit 1313ffd
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions hbox/gui/tools/dotfontscan/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,22 @@ int main(int argc,const char *argv[])
FT_Bitmap bmp=face->glyph->bitmap;
size_t w=bmp.width;
size_t h=bmp.rows;
size_t left=face->glyph->bitmap_left;
size_t top=face->size->metrics.ascender/64-face->glyph->bitmap_top;//转换为屏幕坐标的偏移
printf("char=%08X,left=%d,top=%d,width=%d,height=%d\r\n",(int)(*it),(int)left,(int)top,(int)w,(int)h);
int left=face->glyph->bitmap_left;
int font_size=face->size->metrics.ascender/64;
int top=font_size-face->glyph->bitmap_top;//转换为屏幕坐标的偏移
{
//调整偏移
if(h+top > font_size)
{
top-=(h+top-font_size);
}
if(left < 0)
{
//不允许负偏移
left=0;
}
}
printf("char=%08X,size=%d,left=%d,top=%d,width=%d,height=%d\r\n",(int)(*it),(int)font_size,(int)left,(int)top,(int)w,(int)h);
for(size_t i=0; i<h; i++)
{
for(size_t j=0; j<w; j++)
Expand Down

0 comments on commit 1313ffd

Please sign in to comment.