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 » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Strange issue with text in Painter
Re: Strange issue with text in Painter [message #51050 is a reply to message #51049] Thu, 17 January 2019 12:59 Go to previous messageGo to next message
Tom1
Messages: 612
Registered: March 2007
Contributor
mirek wrote on Thu, 17 January 2019 13:56
What about

HDC Win32_IC()
{
	static HDC hdc;
	ONCELOCK {
		hdc = CreateDC("DISPLAY", NULL, NULL, NULL);
	}
	return hdc;
}


Bad/missing letters were found.

Tom
Re: Strange issue with text in Painter [message #51051 is a reply to message #51049] Thu, 17 January 2019 13:01 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 11825
Registered: November 2005
Ultimate Member
Well, failing VERIFY is interesting. Let us dig a bit more there...

void RenderCharacterSys(FontGlyphConsumer& sw, double x, double y, int ch, Font fnt)
{
	DLOG("RenderCharSys " << fnt << " " << ch << " " << (char)ch);
	static Atomic h;
	h++;
	HFONT hfont = GetWin32Font(fnt, 0);
	VERIFY(hfont);
	if(hfont) {
		HDC hdc = Win32_IC();
		HFONT ohfont = (HFONT) ::SelectObject(hdc, hfont);
		GLYPHMETRICS gm;
		MAT2 m_matrix;
		memset(&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, &gm, 0, NULL, &m_matrix);
		VERIFY(gsz >= 0);
		if(gsz < 0)
			return;
		StringBuffer gb(gsz);
		gsz = GetGlyphOutlineW(hdc, ch, GGO_NATIVE|GGO_UNHINTED, &gm, gsz, ~gb, &m_matrix);
		VERIFY(gsz >= 0);
		if(gsz < 0)
			return;
		RenderCharPath(~gb, gsz, sw, x, y + fnt.GetAscent());
		::SelectObject(hdc, ohfont);
	}
	h--;
	VERIFY(h == 0);
}


If it fails, send me where and the log....
Re: Strange issue with text in Painter [message #51052 is a reply to message #51051] Thu, 17 January 2019 13:04 Go to previous messageGo to next message
Tom1
Messages: 612
Registered: March 2007
Contributor
(Please note, it was VERIFY(h == 0), i.e. your original ASSERT... not VERIFY(hfont).)

Yes, I will test... using RLOG() instead of DLOG().

Tom
Re: Strange issue with text in Painter [message #51053 is a reply to message #51051] Thu, 17 January 2019 13:12 Go to previous messageGo to next message
Tom1
Messages: 612
Registered: March 2007
Contributor
mirek wrote on Thu, 17 January 2019 14:01
Well, failing VERIFY is interesting. Let us dig a bit more there...

void RenderCharacterSys(FontGlyphConsumer& sw, double x, double y, int ch, Font fnt)
{
	DLOG("RenderCharSys " << fnt << " " << ch << " " << (char)ch);
	static Atomic h;
	h++;
	HFONT hfont = GetWin32Font(fnt, 0);
	VERIFY(hfont);
	if(hfont) {
		HDC hdc = Win32_IC();
		HFONT ohfont = (HFONT) ::SelectObject(hdc, hfont);
		GLYPHMETRICS gm;
		MAT2 m_matrix;
		memset(&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, &gm, 0, NULL, &m_matrix);
		VERIFY(gsz >= 0);
		if(gsz < 0)
			return;
		StringBuffer gb(gsz);
		gsz = GetGlyphOutlineW(hdc, ch, GGO_NATIVE|GGO_UNHINTED, &gm, gsz, ~gb, &m_matrix);
		VERIFY(gsz >= 0);
		if(gsz < 0)
			return;
		RenderCharPath(~gb, gsz, sw, x, y + fnt.GetAscent());
		::SelectObject(hdc, ohfont);
	}
	h--;
	VERIFY(h == 0);
}


If it fails, send me where and the log....


VERIFY failed on the first VERIFY(gsz >= 0); on line 415.

Now I even managed to include the log attachment! Smile

BR, Tom
  • Attachment: ChartTest.7z
    (Size: 1.14KB, Downloaded 10 times)
Re: Strange issue with text in Painter [message #51054 is a reply to message #51053] Thu, 17 January 2019 13:34 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 11825
Registered: November 2005
Ultimate Member
What about

void RenderCharacterSys(FontGlyphConsumer& sw, double x, double y, int ch, Font fnt)
{
	RLOG(CoWork::GetWorkerIndex() << " RenderCharSys " << fnt << " " << ch << " " << (char)ch);
	static Atomic h;
	h++;
	HFONT hfont = GetWin32Font(fnt, 0);
	VERIFY(hfont);
	if(hfont) {
		HDC hdc = Win32_IC();
		HFONT ohfont = (HFONT) ::SelectObject(hdc, hfont);
		GLYPHMETRICS gm;
		MAT2 m_matrix;
		memset(&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, &gm, 0, NULL, &m_matrix);
		if(gsz < 0) {
			LOGFONT lf;
			int ret = GetObject(hfont, sizeof(lf), &lf);
			RLOG("Failed " << CoWork::GetWorkerIndex() << " RenderCharSys " << fnt << " " << ch << " " << (char)ch
			               << ", real: "  << " " << lf.lfFaceName << " " << lf.lfHeight);
			RDUMP((void *)hdc);
			RDUMP((void *)hfont);
			RDUMP(GetLastErrorMessage());
		}
		VERIFY(gsz >= 0);
		if(gsz < 0)
			return;
		StringBuffer gb(gsz);
		gsz = GetGlyphOutlineW(hdc, ch, GGO_NATIVE|GGO_UNHINTED, &gm, gsz, ~gb, &m_matrix);
		if(gsz < 0) {
			LOGFONT lf;
			int ret = GetObject(hfont, sizeof(lf), &lf);
			RLOG("Failed2 " << CoWork::GetWorkerIndex() << " RenderCharSys " << fnt << " " << ch << " " << (char)ch
			               << ", real: "  << " " << lf.lfFaceName << " " << lf.lfHeight);
			RDUMP((void *)hdc);
			RDUMP((void *)hfont);
			RDUMP(GetLastErrorMessage());
		}
		VERIFY(gsz >= 0);
		if(gsz < 0)
			return;
		RenderCharPath(~gb, gsz, sw, x, y + fnt.GetAscent());
		::SelectObject(hdc, ohfont);
	}
	h--;
	VERIFY(h == 0);
}
Re: Strange issue with text in Painter [message #51055 is a reply to message #51054] Thu, 17 January 2019 13:40 Go to previous messageGo to next message
Tom1
Messages: 612
Registered: March 2007
Contributor
mirek wrote on Thu, 17 January 2019 14:34
What about

void RenderCharacterSys(FontGlyphConsumer& sw, double x, double y, int ch, Font fnt)
{
	RLOG(CoWork::GetWorkerIndex() << " RenderCharSys " << fnt << " " << ch << " " << (char)ch);
	static Atomic h;
	h++;
	HFONT hfont = GetWin32Font(fnt, 0);
	VERIFY(hfont);
	if(hfont) {
		HDC hdc = Win32_IC();
		HFONT ohfont = (HFONT) ::SelectObject(hdc, hfont);
		GLYPHMETRICS gm;
		MAT2 m_matrix;
		memset(&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, &gm, 0, NULL, &m_matrix);
		if(gsz < 0) {
			LOGFONT lf;
			int ret = GetObject(hfont, sizeof(lf), &lf);
			RLOG("Failed " << CoWork::GetWorkerIndex() << " RenderCharSys " << fnt << " " << ch << " " << (char)ch
			               << ", real: "  << " " << lf.lfFaceName << " " << lf.lfHeight);
			RDUMP((void *)hdc);
			RDUMP((void *)hfont);
			RDUMP(GetLastErrorMessage());
		}
		VERIFY(gsz >= 0);
		if(gsz < 0)
			return;
		StringBuffer gb(gsz);
		gsz = GetGlyphOutlineW(hdc, ch, GGO_NATIVE|GGO_UNHINTED, &gm, gsz, ~gb, &m_matrix);
		if(gsz < 0) {
			LOGFONT lf;
			int ret = GetObject(hfont, sizeof(lf), &lf);
			RLOG("Failed2 " << CoWork::GetWorkerIndex() << " RenderCharSys " << fnt << " " << ch << " " << (char)ch
			               << ", real: "  << " " << lf.lfFaceName << " " << lf.lfHeight);
			RDUMP((void *)hdc);
			RDUMP((void *)hfont);
			RDUMP(GetLastErrorMessage());
		}
		VERIFY(gsz >= 0);
		if(gsz < 0)
			return;
		RenderCharPath(~gb, gsz, sw, x, y + fnt.GetAscent());
		::SelectObject(hdc, ohfont);
	}
	h--;
	VERIFY(h == 0);
}


Again the first VERIFY(gsz >= 0); ASSERTED on line 424. LOG attached...

BR, Tom
  • Attachment: ChartTest.7z
    (Size: 2.74KB, Downloaded 9 times)
Re: Strange issue with text in Painter [message #51056 is a reply to message #51055] Thu, 17 January 2019 13:58 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 11825
Registered: November 2005
Ultimate Member
Tom1 wrote on Thu, 17 January 2019 13:40
mirek wrote on Thu, 17 January 2019 14:34
What about

void RenderCharacterSys(FontGlyphConsumer& sw, double x, double y, int ch, Font fnt)
{
	RLOG(CoWork::GetWorkerIndex() << " RenderCharSys " << fnt << " " << ch << " " << (char)ch);
	static Atomic h;
	h++;
	HFONT hfont = GetWin32Font(fnt, 0);
	VERIFY(hfont);
	if(hfont) {
		HDC hdc = Win32_IC();
		HFONT ohfont = (HFONT) ::SelectObject(hdc, hfont);
		GLYPHMETRICS gm;
		MAT2 m_matrix;
		memset(&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, &gm, 0, NULL, &m_matrix);
		if(gsz < 0) {
			LOGFONT lf;
			int ret = GetObject(hfont, sizeof(lf), &lf);
			RLOG("Failed " << CoWork::GetWorkerIndex() << " RenderCharSys " << fnt << " " << ch << " " << (char)ch
			               << ", real: "  << " " << lf.lfFaceName << " " << lf.lfHeight);
			RDUMP((void *)hdc);
			RDUMP((void *)hfont);
			RDUMP(GetLastErrorMessage());
		}
		VERIFY(gsz >= 0);
		if(gsz < 0)
			return;
		StringBuffer gb(gsz);
		gsz = GetGlyphOutlineW(hdc, ch, GGO_NATIVE|GGO_UNHINTED, &gm, gsz, ~gb, &m_matrix);
		if(gsz < 0) {
			LOGFONT lf;
			int ret = GetObject(hfont, sizeof(lf), &lf);
			RLOG("Failed2 " << CoWork::GetWorkerIndex() << " RenderCharSys " << fnt << " " << ch << " " << (char)ch
			               << ", real: "  << " " << lf.lfFaceName << " " << lf.lfHeight);
			RDUMP((void *)hdc);
			RDUMP((void *)hfont);
			RDUMP(GetLastErrorMessage());
		}
		VERIFY(gsz >= 0);
		if(gsz < 0)
			return;
		RenderCharPath(~gb, gsz, sw, x, y + fnt.GetAscent());
		::SelectObject(hdc, ohfont);
	}
	h--;
	VERIFY(h == 0);
}


Again the first VERIFY(gsz >= 0); ASSERTED on line 424. LOG attached...

BR, Tom


It starts to look like Win32 does not like the sharing of HDC... (despite of what the documentation says).

What about this:

void RenderCharacterSys(FontGlyphConsumer& sw, double x, double y, int ch, Font fnt)
{
	RLOG(CoWork::GetWorkerIndex() << " RenderCharSys " << fnt << " " << ch << " " << (char)ch);
	static Atomic h;
	h++;
	HFONT hfont = GetWin32Font(fnt, 0);
	VERIFY(hfont);
	if(hfont) {
		HDC hdc = CreateIC("DISPLAY", NULL, NULL, NULL);
		HFONT ohfont = (HFONT) ::SelectObject(hdc, hfont);
		GLYPHMETRICS gm;
		MAT2 m_matrix;
		memset(&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, &gm, 0, NULL, &m_matrix);
		if(gsz < 0) {
			LOGFONT lf;
			int ret = GetObject(hfont, sizeof(lf), &lf);
			RLOG("Failed " << CoWork::GetWorkerIndex() << " RenderCharSys " << fnt << " " << ch << " " << (char)ch
			               << ", real: "  << " " << lf.lfFaceName << " " << lf.lfHeight);
			RDUMP((void *)hdc);
			RDUMP((void *)hfont);
			RDUMP(GetLastErrorMessage());
		}
		VERIFY(gsz >= 0);
		if(gsz < 0)
			return;
		StringBuffer gb(gsz);
		gsz = GetGlyphOutlineW(hdc, ch, GGO_NATIVE|GGO_UNHINTED, &gm, gsz, ~gb, &m_matrix);
		if(gsz < 0) {
			LOGFONT lf;
			int ret = GetObject(hfont, sizeof(lf), &lf);
			RLOG("Failed2 " << CoWork::GetWorkerIndex() << " RenderCharSys " << fnt << " " << ch << " " << (char)ch
			               << ", real: "  << " " << lf.lfFaceName << " " << lf.lfHeight);
			RDUMP((void *)hdc);
			RDUMP((void *)hfont);
			RDUMP(GetLastErrorMessage());
		}
		VERIFY(gsz >= 0);
		if(gsz < 0)
			return;
		RenderCharPath(~gb, gsz, sw, x, y + fnt.GetAscent());
		::SelectObject(hdc, ohfont);
		::DeleteDC(hdc);
	}
	h--;
	VERIFY(h == 0);
}

Re: Strange issue with text in Painter [message #51057 is a reply to message #51056] Thu, 17 January 2019 14:12 Go to previous messageGo to next message
Tom1
Messages: 612
Registered: March 2007
Contributor
mirek wrote on Thu, 17 January 2019 14:58
...
It starts to look like Win32 does not like the sharing of HDC... (despite of what the documentation says).

What about this:

void RenderCharacterSys(FontGlyphConsumer& sw, double x, double y, int ch, Font fnt)
{
	RLOG(CoWork::GetWorkerIndex() << " RenderCharSys " << fnt << " " << ch << " " << (char)ch);
	static Atomic h;
	h++;
	HFONT hfont = GetWin32Font(fnt, 0);
	VERIFY(hfont);
	if(hfont) {
		HDC hdc = CreateIC("DISPLAY", NULL, NULL, NULL);
		HFONT ohfont = (HFONT) ::SelectObject(hdc, hfont);
		GLYPHMETRICS gm;
		MAT2 m_matrix;
		memset(&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, &gm, 0, NULL, &m_matrix);
		if(gsz < 0) {
			LOGFONT lf;
			int ret = GetObject(hfont, sizeof(lf), &lf);
			RLOG("Failed " << CoWork::GetWorkerIndex() << " RenderCharSys " << fnt << " " << ch << " " << (char)ch
			               << ", real: "  << " " << lf.lfFaceName << " " << lf.lfHeight);
			RDUMP((void *)hdc);
			RDUMP((void *)hfont);
			RDUMP(GetLastErrorMessage());
		}
		VERIFY(gsz >= 0);
		if(gsz < 0)
			return;
		StringBuffer gb(gsz);
		gsz = GetGlyphOutlineW(hdc, ch, GGO_NATIVE|GGO_UNHINTED, &gm, gsz, ~gb, &m_matrix);
		if(gsz < 0) {
			LOGFONT lf;
			int ret = GetObject(hfont, sizeof(lf), &lf);
			RLOG("Failed2 " << CoWork::GetWorkerIndex() << " RenderCharSys " << fnt << " " << ch << " " << (char)ch
			               << ", real: "  << " " << lf.lfFaceName << " " << lf.lfHeight);
			RDUMP((void *)hdc);
			RDUMP((void *)hfont);
			RDUMP(GetLastErrorMessage());
		}
		VERIFY(gsz >= 0);
		if(gsz < 0)
			return;
		RenderCharPath(~gb, gsz, sw, x, y + fnt.GetAscent());
		::SelectObject(hdc, ohfont);
		::DeleteDC(hdc);
	}
	h--;
	VERIFY(h == 0);
}



As far as I can see, not a single bad or missing letter in 8 minutes of systematic intensive scanning of names. No VERIFYs/ASSERTs either. The log is attached.

BR, Tom
  • Attachment: ChartTest.7z
    (Size: 5.22KB, Downloaded 9 times)
Re: Strange issue with text in Painter [message #51058 is a reply to message #51057] Thu, 17 January 2019 14:16 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 11825
Registered: November 2005
Ultimate Member
Tom1 wrote on Thu, 17 January 2019 14:12
mirek wrote on Thu, 17 January 2019 14:58
...
It starts to look like Win32 does not like the sharing of HDC... (despite of what the documentation says).

What about this:

void RenderCharacterSys(FontGlyphConsumer& sw, double x, double y, int ch, Font fnt)
{
	RLOG(CoWork::GetWorkerIndex() << " RenderCharSys " << fnt << " " << ch << " " << (char)ch);
	static Atomic h;
	h++;
	HFONT hfont = GetWin32Font(fnt, 0);
	VERIFY(hfont);
	if(hfont) {
		HDC hdc = CreateIC("DISPLAY", NULL, NULL, NULL);
		HFONT ohfont = (HFONT) ::SelectObject(hdc, hfont);
		GLYPHMETRICS gm;
		MAT2 m_matrix;
		memset(&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, &gm, 0, NULL, &m_matrix);
		if(gsz < 0) {
			LOGFONT lf;
			int ret = GetObject(hfont, sizeof(lf), &lf);
			RLOG("Failed " << CoWork::GetWorkerIndex() << " RenderCharSys " << fnt << " " << ch << " " << (char)ch
			               << ", real: "  << " " << lf.lfFaceName << " " << lf.lfHeight);
			RDUMP((void *)hdc);
			RDUMP((void *)hfont);
			RDUMP(GetLastErrorMessage());
		}
		VERIFY(gsz >= 0);
		if(gsz < 0)
			return;
		StringBuffer gb(gsz);
		gsz = GetGlyphOutlineW(hdc, ch, GGO_NATIVE|GGO_UNHINTED, &gm, gsz, ~gb, &m_matrix);
		if(gsz < 0) {
			LOGFONT lf;
			int ret = GetObject(hfont, sizeof(lf), &lf);
			RLOG("Failed2 " << CoWork::GetWorkerIndex() << " RenderCharSys " << fnt << " " << ch << " " << (char)ch
			               << ", real: "  << " " << lf.lfFaceName << " " << lf.lfHeight);
			RDUMP((void *)hdc);
			RDUMP((void *)hfont);
			RDUMP(GetLastErrorMessage());
		}
		VERIFY(gsz >= 0);
		if(gsz < 0)
			return;
		RenderCharPath(~gb, gsz, sw, x, y + fnt.GetAscent());
		::SelectObject(hdc, ohfont);
		::DeleteDC(hdc);
	}
	h--;
	VERIFY(h == 0);
}



As far as I can see, not a single bad or missing letter in 8 minutes of systematic intensive scanning of names. No VERIFYs/ASSERTs either. The log is attached.

BR, Tom


Well, so be it, lets call it a fix. I will remove shared information context from the trunk... There will be small performance penalty, but it should be negligible (as there are caches on many levels anyway).

Hopefully my interpretation is right and we are not just hiding some other bug...
Re: Strange issue with text in Painter [message #51059 is a reply to message #51058] Thu, 17 January 2019 14:24 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 11825
Registered: November 2005
Ultimate Member
OK, please check trunk....
Re: Strange issue with text in Painter [message #51060 is a reply to message #51058] Thu, 17 January 2019 14:30 Go to previous messageGo to next message
Tom1
Messages: 612
Registered: March 2007
Contributor
mirek wrote on Thu, 17 January 2019 15:16
Tom1 wrote on Thu, 17 January 2019 14:12
mirek wrote on Thu, 17 January 2019 14:58
...
It starts to look like Win32 does not like the sharing of HDC... (despite of what the documentation says).

What about this:

void RenderCharacterSys(FontGlyphConsumer& sw, double x, double y, int ch, Font fnt)
{
	RLOG(CoWork::GetWorkerIndex() << " RenderCharSys " << fnt << " " << ch << " " << (char)ch);
	static Atomic h;
	h++;
	HFONT hfont = GetWin32Font(fnt, 0);
	VERIFY(hfont);
	if(hfont) {
		HDC hdc = CreateIC("DISPLAY", NULL, NULL, NULL);
		HFONT ohfont = (HFONT) ::SelectObject(hdc, hfont);
		GLYPHMETRICS gm;
		MAT2 m_matrix;
		memset(&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, &gm, 0, NULL, &m_matrix);
		if(gsz < 0) {
			LOGFONT lf;
			int ret = GetObject(hfont, sizeof(lf), &lf);
			RLOG("Failed " << CoWork::GetWorkerIndex() << " RenderCharSys " << fnt << " " << ch << " " << (char)ch
			               << ", real: "  << " " << lf.lfFaceName << " " << lf.lfHeight);
			RDUMP((void *)hdc);
			RDUMP((void *)hfont);
			RDUMP(GetLastErrorMessage());
		}
		VERIFY(gsz >= 0);
		if(gsz < 0)
			return;
		StringBuffer gb(gsz);
		gsz = GetGlyphOutlineW(hdc, ch, GGO_NATIVE|GGO_UNHINTED, &gm, gsz, ~gb, &m_matrix);
		if(gsz < 0) {
			LOGFONT lf;
			int ret = GetObject(hfont, sizeof(lf), &lf);
			RLOG("Failed2 " << CoWork::GetWorkerIndex() << " RenderCharSys " << fnt << " " << ch << " " << (char)ch
			               << ", real: "  << " " << lf.lfFaceName << " " << lf.lfHeight);
			RDUMP((void *)hdc);
			RDUMP((void *)hfont);
			RDUMP(GetLastErrorMessage());
		}
		VERIFY(gsz >= 0);
		if(gsz < 0)
			return;
		RenderCharPath(~gb, gsz, sw, x, y + fnt.GetAscent());
		::SelectObject(hdc, ohfont);
		::DeleteDC(hdc);
	}
	h--;
	VERIFY(h == 0);
}



As far as I can see, not a single bad or missing letter in 8 minutes of systematic intensive scanning of names. No VERIFYs/ASSERTs either. The log is attached.

BR, Tom


Well, so be it, lets call it a fix. I will remove shared information context from the trunk... There will be small performance penalty, but it should be negligible (as there are caches on many levels anyway).

Hopefully my interpretation is right and we are not just hiding some other bug...


OK, I hope so too. Using Windows can be expensive sometimes...

As for the 'rounding of tolerance' we discussed about one hundred (or so) postings ago, should it be brought in rather sooner or later? I would like to test this current solution without other changes for a while before taking in an optimization that will decrease likelihood for error. (Actually, I believe this will solve it for good, but it's better keep an eye on it for a while... This does not 'add to cost' as I will anyway look at the map during testing of new features I'm building on top of this.)

Of course I can take this fix in now, and then postpone updating the tolerance rounding, until a week or so have passed...

In any case, Thank you Mirek for all your help and support!

Best regards,

Tom
Re: Strange issue with text in Painter [message #51061 is a reply to message #51060] Thu, 17 January 2019 14:33 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 11825
Registered: November 2005
Ultimate Member
I will deal with tolerance after we are sure that the issue is fixed (otherwise it would hide that bug).

It will be actually pretty simple, what I plan to do is this:

		tolerance = float(0.3 / attr.mtx.GetScale());


Smile

Mirek
Re: Strange issue with text in Painter [message #51062 is a reply to message #51059] Thu, 17 January 2019 14:47 Go to previous messageGo to next message
Tom1
Messages: 612
Registered: March 2007
Contributor
mirek wrote on Thu, 17 January 2019 15:24
OK, please check trunk....


Updated... Tested... Not a single false or missing letter as far as I can see. Smile

BR, Tom
Re: Strange issue with text in Painter [message #51063 is a reply to message #51062] Thu, 17 January 2019 14:51 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 11825
Registered: November 2005
Ultimate Member
Tom1 wrote on Thu, 17 January 2019 14:47
mirek wrote on Thu, 17 January 2019 15:24
OK, please check trunk....


Updated... Tested... Not a single false or missing letter as far as I can see. Smile

BR, Tom


So it took only one week and 170 posts? Smile

Mirek
Re: Strange issue with text in Painter [message #51064 is a reply to message #51061] Thu, 17 January 2019 14:51 Go to previous messageGo to next message
Tom1
Messages: 612
Registered: March 2007
Contributor
mirek wrote on Thu, 17 January 2019 15:33
I will deal with tolerance after we are sure that the issue is fixed (otherwise it would hide that bug).

It will be actually pretty simple, what I plan to do is this:

		tolerance = float(0.3 / attr.mtx.GetScale());


Smile

Mirek


OK, that's simple, clear and does not eat many CPU cycles! Smile

BR, Tom
Re: Strange issue with text in Painter [message #51065 is a reply to message #51063] Thu, 17 January 2019 14:52 Go to previous messageGo to next message
Tom1
Messages: 612
Registered: March 2007
Contributor
mirek wrote on Thu, 17 January 2019 15:51
Tom1 wrote on Thu, 17 January 2019 14:47
mirek wrote on Thu, 17 January 2019 15:24
OK, please check trunk....


Updated... Tested... Not a single false or missing letter as far as I can see. Smile

BR, Tom


So it took only one week and 170 posts? Smile

Mirek


Must be a record!!!
Re: Strange issue with text in Painter [message #51071 is a reply to message #51065] Sat, 19 January 2019 17:46 Go to previous message
koldo is currently offline  koldo
Messages: 2944
Registered: August 2008
Veteran
Very Happy Very Happy

Best regards
IƱaki
Previous Topic: MT + Subpixel appear incompatible in Painter
Next Topic: Painter: Excessive memory usage in PainterExamples moving window to edges of screen.
Goto Forum:
  


Current Time: Fri Apr 19 12:49:00 CEST 2019

Total time taken to generate the page: 0.01386 seconds