convert file codes to UTF8-BOM

This commit is contained in:
hyzboy 2020-07-29 01:00:25 +08:00
parent 38d810cd6c
commit 8cc35599ad
13 changed files with 129 additions and 132 deletions

3
.gitmodules vendored
View File

@ -1,9 +1,6 @@
[submodule "3rdpty/MathGeoLib"] [submodule "3rdpty/MathGeoLib"]
path = 3rdpty/MathGeoLib path = 3rdpty/MathGeoLib
url = https://github.com/juj/MathGeoLib.git url = https://github.com/juj/MathGeoLib.git
[submodule "3rdpty/SPIRV-Cross"]
path = 3rdpty/SPIRV-Cross
url = https://github.com/KhronosGroup/SPIRV-Cross
[submodule "3rdpty/jsoncpp"] [submodule "3rdpty/jsoncpp"]
path = 3rdpty/jsoncpp path = 3rdpty/jsoncpp
url = https://github.com/open-source-parsers/jsoncpp url = https://github.com/open-source-parsers/jsoncpp

@ -1 +1 @@
Subproject commit 7eb1cafe575cc305a9d09fce66494a5445da5305 Subproject commit b2676f3e15b059069611a20a4b998b2387dbe9c2

View File

@ -1,4 +1,4 @@
#ifndef HGL_GRAPH_RENDERABLE_CREATER_INCLUDE #ifndef HGL_GRAPH_RENDERABLE_CREATER_INCLUDE
#define HGL_GRAPH_RENDERABLE_CREATER_INCLUDE #define HGL_GRAPH_RENDERABLE_CREATER_INCLUDE
#include<hgl/graph/SceneDB.h> #include<hgl/graph/SceneDB.h>

View File

@ -1,4 +1,4 @@
#ifndef HGL_GRAPH_TEXTURE_LOADER_INCLUDE #ifndef HGL_GRAPH_TEXTURE_LOADER_INCLUDE
#define HGL_GRAPH_TEXTURE_LOADER_INCLUDE #define HGL_GRAPH_TEXTURE_LOADER_INCLUDE
#include<hgl/io/InputStream.h> #include<hgl/io/InputStream.h>

View File

@ -1,36 +1,36 @@
#ifndef HGL_GRAPH_FONT_INCLUDE #ifndef HGL_GRAPH_FONT_INCLUDE
#define HGL_GRAPH_FONT_INCLUDE #define HGL_GRAPH_FONT_INCLUDE
#include<hgl/type/DataType.h> #include<hgl/type/DataType.h>
namespace hgl namespace hgl
{ {
namespace graph namespace graph
{ {
constexpr size_t MAX_FONT_NAME_LENGTH=128; constexpr size_t MAX_FONT_NAME_LENGTH=128;
/** /**
* *
*/ */
struct Font struct Font
{ {
os_char name[MAX_FONT_NAME_LENGTH]; ///<字体名称 os_char name[MAX_FONT_NAME_LENGTH]; ///<字体名称
int width; ///<宽度 int width; ///<宽度
int height; ///<高度 int height; ///<高度
bool bold; ///<加粗 bool bold; ///<加粗
bool italic; ///<右斜 bool italic; ///<右斜
bool anti; ///<反矩齿 bool anti; ///<反矩齿
public: public:
Font(); Font();
Font(const os_char *,int,int,bool,bool,bool=true); Font(const os_char *,int,int,bool,bool,bool=true);
CompOperatorMemcmp(const Font &); ///<比较操作符重载 CompOperatorMemcmp(const Font &); ///<比较操作符重载
};//struct Font };//struct Font
}//namespace graph }//namespace graph
}//namespace hgl }//namespace hgl
#endif//HGL_GRAPH_FONT_INCLUDE #endif//HGL_GRAPH_FONT_INCLUDE

View File

@ -1,4 +1,4 @@
#ifndef HGL_GRAPH_FONT_SOURCE_INCLUDE #ifndef HGL_GRAPH_FONT_SOURCE_INCLUDE
#define HGL_GRAPH_FONT_SOURCE_INCLUDE #define HGL_GRAPH_FONT_SOURCE_INCLUDE
#include<hgl/type/StrChar.h> #include<hgl/type/StrChar.h>

View File

@ -1,4 +1,4 @@
#ifndef HGL_GRAPH_TEXT_LAYOUT_INCLUDE #ifndef HGL_GRAPH_TEXT_LAYOUT_INCLUDE
#define HGL_GRAPH_TEXT_LAYOUT_INCLUDE #define HGL_GRAPH_TEXT_LAYOUT_INCLUDE
#include<hgl/type/StringList.h> #include<hgl/type/StringList.h>

View File

@ -1,4 +1,4 @@
#ifndef HGL_GRAPH_TILE_FONT_INCLUDE #ifndef HGL_GRAPH_TILE_FONT_INCLUDE
#define HGL_GRAPH_TILE_FONT_INCLUDE #define HGL_GRAPH_TILE_FONT_INCLUDE
#include<hgl/graph/TileData.h> #include<hgl/graph/TileData.h>

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#include<hgl/type/BaseString.h> #include<hgl/type/BaseString.h>
#include<hgl/type/List.h> #include<hgl/type/List.h>
#include<hgl/type/StringList.h> #include<hgl/type/StringList.h>

View File

@ -1,9 +1,9 @@
#include<hgl/graph/font/FontSource.h> #include<hgl/graph/font/FontSource.h>
namespace hgl namespace hgl
{ {
namespace graph namespace graph
{ {
FontSource *CreateFontSource(const Font &f); //各平台独立提供 FontSource *CreateFontSource(const Font &f); //各平台独立提供
static MapObject<Font,FontSource> FontStorage; static MapObject<Font,FontSource> FontStorage;

View File

@ -1,128 +1,128 @@
#include<hgl/graph/font/FontSource.h> #include<hgl/graph/font/FontSource.h>
namespace hgl namespace hgl
{ {
namespace graph namespace graph
{ {
FontSourceMulti::FontSourceMulti(FontSource *fs) FontSourceMulti::FontSourceMulti(FontSource *fs)
{ {
default_source=fs; default_source=fs;
if(fs) if(fs)
fs->RefAcquire(this); fs->RefAcquire(this);
max_char_height=fs->GetCharHeight(); max_char_height=fs->GetCharHeight();
} }
FontSourceMulti::~FontSourceMulti() FontSourceMulti::~FontSourceMulti()
{ {
if(default_source) if(default_source)
default_source->RefRelease(this); default_source->RefRelease(this);
} }
void FontSourceMulti::Add(UnicodeBlock ub,FontSource *fs) void FontSourceMulti::Add(UnicodeBlock ub,FontSource *fs)
{ {
if(ub<UnicodeBlock::BEGIN_RANGE if(ub<UnicodeBlock::BEGIN_RANGE
||ub>UnicodeBlock::END_RANGE ||ub>UnicodeBlock::END_RANGE
||!fs ||!fs
||fs==default_source)return; ||fs==default_source)return;
if(fs->GetCharHeight()>max_char_height) if(fs->GetCharHeight()>max_char_height)
max_char_height=fs->GetCharHeight(); max_char_height=fs->GetCharHeight();
source_map.Update(ub,fs); source_map.Update(ub,fs);
} }
void FontSourceMulti::RefreshMaxCharHeight() void FontSourceMulti::RefreshMaxCharHeight()
{ {
max_char_height=0; max_char_height=0;
const int count=source_map.GetCount(); const int count=source_map.GetCount();
auto **fsp=source_map.GetDataList(); auto **fsp=source_map.GetDataList();
for(int i=0;i<count;i++) for(int i=0;i<count;i++)
{ {
if((*fsp)->right->GetCharHeight()>max_char_height) if((*fsp)->right->GetCharHeight()>max_char_height)
max_char_height=(*fsp)->right->GetCharHeight(); max_char_height=(*fsp)->right->GetCharHeight();
++fsp; ++fsp;
} }
} }
void FontSourceMulti::Remove(UnicodeBlock ub) void FontSourceMulti::Remove(UnicodeBlock ub)
{ {
FontSourcePointer fsp; FontSourcePointer fsp;
if(source_map.Get(ub,fsp)) if(source_map.Get(ub,fsp))
{ {
const bool refresh=(fsp->GetCharHeight()==max_char_height); const bool refresh=(fsp->GetCharHeight()==max_char_height);
fsp->RefRelease(this); fsp->RefRelease(this);
source_map.DeleteByKey(ub); source_map.DeleteByKey(ub);
if(refresh) if(refresh)
RefreshMaxCharHeight(); RefreshMaxCharHeight();
} }
} }
void FontSourceMulti::Remove(FontSource *fs) void FontSourceMulti::Remove(FontSource *fs)
{ {
if(!fs)return; if(!fs)return;
if(fs==default_source)return; if(fs==default_source)return;
if(source_map.ValueExist(fs)) if(source_map.ValueExist(fs))
{ {
const bool refresh=(fs->GetCharHeight()==max_char_height); const bool refresh=(fs->GetCharHeight()==max_char_height);
fs->RefRelease(this); fs->RefRelease(this);
source_map.DeleteByValue(fs); source_map.DeleteByValue(fs);
if(refresh) if(refresh)
RefreshMaxCharHeight(); RefreshMaxCharHeight();
} }
} }
FontSource *FontSourceMulti::GetFontSource(const u32char &ch) FontSource *FontSourceMulti::GetFontSource(const u32char &ch)
{ {
if(hgl::isspace(ch))return(nullptr); //不能显示的数据或是空格 if(hgl::isspace(ch))return(nullptr); //不能显示的数据或是空格
const auto count=source_map.GetCount(); const auto count=source_map.GetCount();
if(count>0) if(count>0)
{ {
auto **fsp=source_map.GetDataList(); auto **fsp=source_map.GetDataList();
for(int i=0;i<count;i++) for(int i=0;i<count;i++)
{ {
if(IsInUnicodeBlock((*fsp)->left,ch)) if(IsInUnicodeBlock((*fsp)->left,ch))
return (*fsp)->right; return (*fsp)->right;
++fsp; ++fsp;
} }
} }
return default_source; return default_source;
} }
FontBitmap *FontSourceMulti::GetCharBitmap(const u32char &ch) FontBitmap *FontSourceMulti::GetCharBitmap(const u32char &ch)
{ {
FontSource *s=GetFontSource(ch); FontSource *s=GetFontSource(ch);
if(!s) if(!s)
return(nullptr); return(nullptr);
return s->GetCharBitmap(ch); return s->GetCharBitmap(ch);
} }
const bool FontSourceMulti::GetCharMetrics(CharMetricsInfo &cmi,const u32char &ch) const bool FontSourceMulti::GetCharMetrics(CharMetricsInfo &cmi,const u32char &ch)
{ {
FontSource *s=GetFontSource(ch); FontSource *s=GetFontSource(ch);
if(!s) if(!s)
return(0); return(0);
return s->GetCharMetrics(cmi,ch); return s->GetCharMetrics(cmi,ch);
} }
}//namespace graph }//namespace graph
}//namespace hgl }//namespace hgl

View File

@ -1,4 +1,4 @@
#include<hgl/graph/font/FontSource.h> #include<hgl/graph/font/FontSource.h>
namespace hgl namespace hgl
{ {

View File

@ -1,4 +1,4 @@
#include<hgl/graph/font/TileFont.h> #include<hgl/graph/font/TileFont.h>
#include<hgl/graph/vulkan/VKDevice.h> #include<hgl/graph/vulkan/VKDevice.h>
#include<hgl/graph/vulkan/VKFormat.h> #include<hgl/graph/vulkan/VKFormat.h>
@ -6,7 +6,7 @@ namespace hgl
{ {
namespace graph namespace graph
{ {
FontSource *AcquireFontSource(const Font &f); FontSource *AcquireFontSource(const Font &f);
TileFont::TileFont(TileData *td,FontSource *fs) TileFont::TileFont(TileData *td,FontSource *fs)
{ {