Open IanByun opened 5 years ago
Do you support Chinese?
Do you support Chinese?
Change font family to whatever chinese font. SimSun or Microsoft YaHei would do.
config.font_family_standard = "Malgun Gothic";
config.font_family_fixed = "Malgun Gothic";
config.font_family_serif = "Malgun Gothic";
config.font_family_sans_serif = "Malgun Gothic";
my try all chinese font,but can't normal render ` ultralight::Platform& platform = ultralight::Platform::instance(); platform.set_gpu_driver(DefaultGPUDriver()); Config conf = Config(); conf.font_family_standard = conf.font_family_fixed = conf.font_family_fixed = conf.font_family_sans_serif = "SimSun"; conf.user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36"; platform.set_config(conf);
platform.set_font_loader(DefaultFontLoader()); `
@MatrixHan I think the problem is not about the font itself, but how Ultralight renders it using PC chrome user agent.
Try using mobile user agent which is,
Mozilla/5.0 (Linux; Android 8.1.0; SM-G965F Build/OPM2.171019.029) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/7.2 Chrome/59.0.3071.125 Mobile Safari/537.36
my try it,but don't normal my use bitmap bytes render , Is this not working properly? `renderer->Render(); int width = view->bitmap()->width(); int height = view_->bitmap()->height(); int formatbyte = 0; char * bytes = nullptr; if (view->bitmap()->format() == BitmapFormat::kBitmapFormat_RGBA8) { formatbyte = 4; } else if (view->bitmap()->format() == BitmapFormat::kBitmapFormat_A8) { format_byte = 1; } int nBytes = formatbyte widthheight; bytes = new char[nBytes]; memset(bytes, 0, nBytes); view->bitmap()->LockPixels(); memcpy(bytes, view_->bitmap()->rawpixels(), nBytes); view->bitmap()->UnlockPixels(); ITexture* pTex = gEnv->pRenderer->EF_LoadTexture(scence_texture, FT_DONT_STREAM | FT_NOMIPS);
IRenderAuxImage::Draw2dImage(0.0f, 0.0f, (float)width, (float)height, pTex->GetTextureID(), 0.0f, 1.0f, 1.0f, 0.0f);
int textureID = gEnv->pRenderer->UploadToVideoMemory(nullptr, width, height, eTF_R8G8B8A8, eTF_R8G8B8A8, 0, true, FILTER_BILINEAR, 0, pTex->GetName(), FT_NOMIPS);
gEnv->pRenderer->UpdateTextureInVideoMemory(pTex->GetTextureID(), (uchar*)bytes, 0, 0, width, height, eTF_R8G8B8A8);
SAFE_DELETE_ARRAY(bytes);`
The screen is rendered OK on your case, and only fonts are causing errors. I am not the developer of this repo, so I cannot consult in detail. My biggest speculation is that, there is something wrong with loading fonts. As you can see, Korean fonts do not correctly render some of the simplified Chinese, but at least it does correctly some letters for example 一下. On the otherhand, you say you correctly loaded the font, but all the letters are blurred. Font names and font family names are different. In my case the font name is "맑은 고딕", while the family name is "Malgun Gothic". Please double check.
Ref Create() comments say that one should "set your Config before creating App".
https://github.com/ultralight-ux/AppCore/blob/0dfc7936e4ecdce4655b52dfb682ec40c080eb63/include/AppCore/App.h#L51
However, as AppWin::AppWin() constructor overrides with Platform::instance().set_config, it has no effect. https://github.com/ultralight-ux/AppCore/blob/0dfc7936e4ecdce4655b52dfb682ec40c080eb63/src/win/AppWin.cpp#L23
For example, if I load https://google.co.kr like below,
The result is like this:
The CORRECT way to setup config is,
which leads to Chrome-like correctly rendered scene.