Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » Will UPP support full UNICODE (21bits long codepoint)?
Re: Will UPP support full UNICODE (21bits long codepoint)? [message #54623 is a reply to message #54611] Sat, 22 August 2020 18:01 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14049
Registered: November 2005
Ultimate Member
I am now investigating the whole thing in Win32. Let us say we would want just to support 32-bit codepoints as the first step.

Now current model needs following info: a) that the font has glyph for required, b) at least advance width for the glyph.

If we do not want to use Uniscribe, just good old GDI, so far I have only found solution to b), but unfortunately it returns just dimensions of that "box" character that is used in case glyph is missing instead of indicating anyhow that it is actually missing....

void Test(int ch, Font fnt)
{
	TIMING("Glyph");
	HFONT hfont = GetWin32Font(fnt, 0);
	VERIFY(hfont);
	if(hfont) {
		HDC hdc = CreateIC("DISPLAY", NULL, NULL, NULL);
		HFONT ohfont = (HFONT) ::SelectObject(hdc, hfont);
		GLYPHMETRICS gm;
		memset(&gm, 0, sizeof(gm));
		MAT2 m_matrix;
		memset8(&m_matrix, 0, sizeof(m_matrix));
		m_matrix.eM11.value = 1;
		m_matrix.eM22.value = 1;
		int gsz = GetGlyphOutlineW(hdc, ch, GGO_NATIVE|GGO_UNHINTED|GGO_METRICS, &gm, 0, NULL, &m_matrix);
		if(gsz == GDI_ERROR)
			DLOG("Failed " << ch);
		if(gm.gmCellIncX != 75)
			DLOG(ch << " " << gm.gmCellIncX << ", " << gm.gmCellIncY << ", " << gm.gmptGlyphOrigin.x);
		::SelectObject(hdc, ohfont);
		::DeleteDC(hdc);
	}
}

GUI_APP_MAIN
{
	for(int i = 32; i < 100000; i++)
		Test(i, Font().Height(100).FaceName("MingLiU-ExtB"));
}
Re: Will UPP support full UNICODE (21bits long codepoint)? [message #54625 is a reply to message #54623] Sat, 22 August 2020 19:29 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1116
Registered: August 2007
Senior Contributor
Quote:
If we do not want to use Uniscribe, just good old GDI,


Why not? Does U++ also takes care of devices that rely exclusively on GDI?

I would even suggest moving to DirectWrite (IIRC, Novo did suggest moving to Directx some time ago...)


The only GDI function that comes to my mind (to determine if the glyph is missing) is GetGlyphIndices().
It takes a string and let you mark the non-existing ones.



https://docs.microsoft.com/tr-tr/windows/win32/api/wingdi/nf -wingdi-getglyphindicesw

Best regards,
Oblivion


[Updated on: Sat, 22 August 2020 19:31]

Report message to a moderator

Re: Will UPP support full UNICODE (21bits long codepoint)? [message #54627 is a reply to message #54625] Sun, 23 August 2020 10:06 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14049
Registered: November 2005
Ultimate Member
Oblivion wrote on Sat, 22 August 2020 19:29
Quote:
If we do not want to use Uniscribe, just good old GDI,


Why not? Does U++ also takes care of devices that rely exclusively on GDI?


I guess it is about a) minimising changes in the code b) implementing in other platforms.

I believe we should do this in several phases:

Phase 1: Moving to code to utf8 (that is String instead of WString) and 32-bit codepoints support.
Phase 2: Basic combining characters support
Phase 3: Advanced text layout

for phase 3, we can either decide to use platform specific library (Uniscribe/pango), which would mean encapsulating it to something platform independent, or just use Harfbuzz on all platforms, which I guess will require dealing with glyph metrics and presence.

Mirek

[Updated on: Sun, 23 August 2020 10:07]

Report message to a moderator

Re: Will UPP support full UNICODE (21bits long codepoint)? [message #54628 is a reply to message #54627] Sun, 23 August 2020 10:52 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1116
Registered: August 2007
Senior Contributor
Quote:

for phase 3, we can either decide to use platform specific library (Uniscribe/pango), which would mean encapsulating it to something platform independent, or just use Harfbuzz


To my knowledge, the latest version of pango can be compiled on Windows too (but satisfying its dependencies might not worth the effort). Also, the latest version of it seems to support harfbuzz as a backend.


[Updated on: Sun, 23 August 2020 10:53]

Report message to a moderator

Re: Will UPP support full UNICODE (21bits long codepoint)? [message #54629 is a reply to message #54628] Sun, 23 August 2020 13:15 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14049
Registered: November 2005
Ultimate Member
Oblivion wrote on Sun, 23 August 2020 10:52
Quote:

for phase 3, we can either decide to use platform specific library (Uniscribe/pango), which would mean encapsulating it to something platform independent, or just use Harfbuzz


To my knowledge, the latest version of pango can be compiled on Windows too (but satisfying its dependencies might not worth the effort). Also, the latest version of it seems to support harfbuzz as a backend.


Well, pango is definitely using harfbuzz, it is AFAIK even developed by the same person...
Re: Will UPP support full UNICODE (21bits long codepoint)? [message #54640 is a reply to message #54629] Mon, 24 August 2020 11:31 Go to previous message
mirek is currently offline  mirek
Messages: 14049
Registered: November 2005
Ultimate Member
https://stackoverflow.com/questions/54050095/how-to-tell-if- a-surrogate-pair-unicode-character-is-supported-by-the-font

Looks like GetCharacterPlacement should do what we need...

Will test soon.

Mirek
Previous Topic: [Proposition] Simply source package manager for Upp
Next Topic: Uppiverse2
Goto Forum:
  


Current Time: Fri Oct 04 14:45:27 CEST 2024

Total time taken to generate the page: 0.02125 seconds