Hey guys
Im playing with the wxRTC sample, which is able to save richtext into html by standard (I think it comes from wxFile or Dialog class).
I am trying to reverse that process and atm I am stuck at translating HTML font size (1-7) into point (pt) for setting correct sizes for the wxRTC.
Do you know any helping function or code to translate html font size into pt?
Or do you know where I get the source code of the saving function, so I can get an idea how the pt size of wxRTC is translated into html size, so I can reverse ingeneer it?
Or any hint in general?
Since there is a bunch of data to be considered (like screen resolution, monitor size, used font...) to do this manually, Im really hoping I don't need to.
Have my thanks.
Natu
Translate HTML Font size to pt Topic is solved
Re: Translate HTML Font size to pt
From the wxRTC sources:
Code: Select all
wxRichTextHTMLHandler::wxRichTextHTMLHandler(const wxString& name, const wxString& ext, int type)
: wxRichTextFileHandler(name, ext, type), m_buffer(NULL), m_font(false), m_inTable(false)
{
m_fontSizeMapping.Add(8);
m_fontSizeMapping.Add(10);
m_fontSizeMapping.Add(13);
m_fontSizeMapping.Add(17);
m_fontSizeMapping.Add(22);
m_fontSizeMapping.Add(30);
m_fontSizeMapping.Add(100);
}
Code: Select all
long wxRichTextHTMLHandler::PtToSize(long size)
{
int i;
int len = m_fontSizeMapping.GetCount();
for (i = 0; i < len; i++)
if (size <= m_fontSizeMapping[i])
return i+1;
return 7;
}
Use the source, Luke!
Re: Translate HTML Font size to pt
That's a nice one, have my thanks, doublemax.
Re: Translate HTML Font size to pt
For completeness sake, this seems to be what browser tools advise or take for you:
1: 8pt
2: 10pt
3: 12pt
4: 14pt
5: 18pt
6: 24pt
7: 36pt
I guess this will change from time to time, but for now it suits our needs.
Have a good one
Natu
1: 8pt
2: 10pt
3: 12pt
4: 14pt
5: 18pt
6: 24pt
7: 36pt
I guess this will change from time to time, but for now it suits our needs.
Have a good one
Natu