upgrade FontSource serial codes

This commit is contained in:
2020-07-08 21:56:39 +08:00
parent af1510b6fc
commit 0b07d04eb2
4 changed files with 182 additions and 46 deletions

View File

@@ -50,26 +50,47 @@ namespace hgl
source_map.DeleteByValue(fs);
}
}
FontBitmap *FontSourceMulti::GetCharBitmap(const u32char &ch)
FontSource *FontSourceMulti::GetFontSource(const u32char &ch)
{
if(hgl::isspace(ch))return(nullptr); //不能显示的数据或是空格
const auto count=source_map.GetCount();
auto **fsp=source_map.GetDataList();
for(int i=0;i<count;i++)
if(count>0)
{
if(IsInUnicodeBlock((*fsp)->left,ch))
return (*fsp)->right->GetCharBitmap(ch);
auto **fsp=source_map.GetDataList();
++fsp;
for(int i=0;i<count;i++)
{
if(IsInUnicodeBlock((*fsp)->left,ch))
return (*fsp)->right;
++fsp;
}
}
if(default_source)
return default_source->GetCharBitmap(ch);
return default_source;
}
return nullptr;
FontBitmap *FontSourceMulti::GetCharBitmap(const u32char &ch)
{
FontSource *s=GetFontSource(ch);
if(!s)
return(nullptr);
return s->GetCharBitmap(ch);
}
int FontSourceMulti::GetCharAdvWidth(const u32char &ch)
{
FontSource *s=GetFontSource(ch);
if(!s)
return(0);
return s->GetCharAdvWidth(ch);
}
}//namespace graph
}//namespace hgl