EncodeHTML support for superscript, subscript, strikeout and smallcaps

git-svn-id: svn://ultimatepp.org/upp/trunk@387 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2008-08-30 08:31:18 +00:00
parent 82b1f55206
commit 91ede46201
2 changed files with 84 additions and 18 deletions

View file

@ -1,11 +1,58 @@
TITLE("Design decisions and tradeoffs")
COMPRESSED
120,156,133,86,107,111,27,199,21,253,43,131,200,9,36,121,73,236,188,246,65,162,69,12,41,40,130,198,177,17,215,205,7,65,45,135,187,67,114,234,125,176,51,187,150,152,162,254,237,61,119,118,169,8,181,138,90,48,41,174,230,190,206,227,14,239,4,123,245,42,77,210,139,244,255,252,91,221,218,157,25,155,225,254,174,17,69,177,118,121,170,214,134,231,235,119,229,250,203,151,47,203,178,20,107,74,197,145,138,167,74,114,193,185,74,83,37,114,174,203,180,212,5,47,82,153,43,161,243,84,175,142,198,155,246,254,206,20,114,125,253,75,134,40,145,232,11,201,37,79,121,38,20,78,165,50,21,138,11,205,139,66,241,92,23,178,204,178,85,101,142,131,235,187,251,187,45,197,81,49,137,176,52,47,50,197,17,164,180,144,185,86,8,86,138,115,252,206,117,158,229,249,106,112,67,99,239,239,28,117,189,229,89,190,54,74,80,215,55,148,65,37,217,5,218,20,57,82,40,161,50,37,11,33,121,33,68,86,74,85,42,244,207,197,202,13,22,221,110,17,70,161,20,166,81,88,
105,197,37,128,81,185,150,56,150,227,93,165,37,23,168,94,164,90,163,176,125,60,163,69,64,81,92,134,114,34,215,116,186,80,5,151,121,33,148,200,4,26,72,115,76,75,213,245,170,182,161,66,156,20,124,61,160,165,245,205,247,122,205,17,156,39,249,133,72,203,84,100,121,137,130,104,22,131,203,178,228,178,64,65,197,117,202,229,170,234,107,12,187,21,58,149,177,98,1,62,50,100,142,216,232,140,163,97,33,11,148,204,185,148,120,213,170,200,87,193,18,35,67,239,239,239,174,191,191,76,151,233,82,104,125,69,225,37,194,11,169,164,84,89,169,120,42,81,6,57,20,225,149,165,224,148,107,81,172,182,38,160,230,160,8,220,136,42,39,65,129,0,89,104,137,210,25,94,64,46,6,148,192,70,148,170,144,178,72,87,85,99,66,120,6,208,53,13,201,121,194,249,69,78,184,106,41,84,73,224,72,1,128,69,166,75,14,132,117,166,82,177,242,246,159,163,243,182,181,29,32,118,208,200,250,76,207,172,71,52,51,233,81,36,92,64,145,58,203,82,194,75,67,21,66,106,
0,158,242,66,161,35,252,128,226,97,150,228,246,247,25,100,194,229,69,41,148,68,39,165,82,64,0,9,120,201,57,79,11,252,96,50,224,18,181,193,103,117,61,23,22,87,9,87,23,57,180,12,166,74,69,229,75,73,248,9,192,47,178,84,131,7,49,133,11,66,93,188,2,238,92,20,244,63,34,207,117,194,97,10,180,200,181,198,220,18,80,139,2,179,107,96,47,163,206,121,94,172,126,182,15,225,214,12,118,22,204,245,205,171,73,105,60,75,120,118,145,82,188,46,74,16,200,21,225,39,149,42,69,41,165,22,165,150,89,10,28,195,228,105,10,38,95,69,79,62,37,201,19,158,195,97,152,85,107,76,31,195,48,121,206,169,21,81,148,25,161,48,39,217,44,26,215,81,31,80,198,122,18,195,245,205,107,206,115,74,84,192,48,69,145,165,178,4,24,192,32,213,80,58,182,66,1,162,193,179,128,13,104,45,84,159,204,222,110,22,179,101,255,245,247,127,127,251,195,207,139,143,31,216,93,16,107,118,107,131,219,119,172,182,149,11,216,3,129,153,174,102,131,55,53,34,
250,221,46,124,119,127,23,210,181,131,15,214,91,41,215,239,210,53,123,51,176,225,96,89,219,147,80,18,246,96,89,24,124,223,237,155,19,219,153,207,189,199,71,51,184,138,161,243,79,174,219,179,126,199,62,110,94,111,94,179,185,149,176,100,63,238,88,215,15,7,250,171,109,130,77,152,27,88,107,62,217,48,159,52,199,99,96,193,54,187,205,162,234,187,193,0,131,154,93,14,253,222,162,178,103,15,110,56,176,112,10,224,153,178,47,27,115,138,125,47,93,219,176,157,107,108,184,138,159,77,19,122,214,142,213,1,141,225,176,103,67,207,154,222,212,204,117,236,39,215,141,143,236,242,31,99,24,88,213,183,144,42,205,97,60,134,115,45,26,161,174,127,237,125,61,23,195,176,236,207,183,63,48,178,37,158,225,15,155,197,209,247,149,13,161,247,87,75,246,225,128,4,53,219,142,174,169,3,48,65,54,215,30,155,104,38,60,111,49,2,240,65,125,60,245,253,103,59,157,156,107,57,34,96,59,238,129,105,109,151,47,64,126,243,254,35,59,152,64,241,91,203,172,139,40,52,
110,0,163,155,133,237,106,103,58,6,224,183,110,255,244,241,210,62,246,196,130,241,213,1,134,168,134,17,138,98,52,37,144,103,97,60,30,123,143,206,174,18,170,190,107,204,192,164,216,44,182,68,4,154,160,108,120,158,169,103,143,38,32,220,111,182,223,93,186,110,184,98,127,220,252,129,41,208,114,64,176,11,12,203,99,136,24,118,181,241,53,48,185,25,189,199,248,52,183,13,132,2,141,241,117,63,14,171,51,97,111,222,222,102,10,111,191,188,141,212,189,239,129,225,251,155,255,5,6,29,33,214,192,181,143,73,226,64,68,13,32,154,135,99,111,129,179,217,54,22,45,250,209,178,29,102,50,221,137,237,171,138,29,49,48,62,183,49,209,219,15,127,189,153,100,71,204,53,205,213,75,85,127,181,209,36,245,84,2,158,233,81,21,37,131,219,58,48,113,34,193,108,190,233,199,129,124,179,89,180,182,237,253,105,243,13,179,143,149,141,87,236,100,45,111,43,116,229,79,209,3,79,98,111,92,101,232,12,219,247,36,189,113,160,108,83,138,232,141,64,90,58,177,163,7,238,
33,186,207,122,143,113,32,158,0,71,77,166,181,190,117,29,182,22,252,245,151,3,248,120,162,228,232,205,190,141,150,4,228,125,51,198,74,155,5,234,120,180,119,180,222,217,174,178,116,126,162,242,25,155,80,117,61,89,169,235,250,19,249,21,195,27,48,104,33,97,223,111,225,158,14,61,176,3,9,158,206,33,184,162,179,3,9,213,219,198,129,128,51,255,75,246,6,134,76,160,38,120,238,204,64,152,116,245,217,249,97,52,205,60,52,158,53,13,236,27,79,238,188,181,191,89,24,23,213,183,118,71,184,255,23,204,152,176,7,207,45,171,65,51,177,3,207,117,193,161,197,35,161,19,30,0,49,122,135,34,251,174,131,244,192,161,11,1,103,1,66,61,125,3,155,21,117,60,225,165,195,62,27,43,220,220,191,251,197,52,13,4,25,169,31,14,190,127,120,78,43,124,50,17,121,73,196,64,149,45,224,245,214,4,188,125,125,126,130,234,193,132,175,134,64,225,218,209,145,171,153,192,198,181,110,152,116,17,241,136,136,182,144,79,92,96,187,145,44,68,24,163,20,72,127,65,
179,111,205,163,107,199,150,117,99,187,133,79,160,41,59,109,164,216,52,121,225,105,55,159,215,44,102,134,185,171,102,172,137,236,63,125,252,241,41,36,65,63,159,236,179,92,24,43,230,185,245,253,241,39,23,176,16,208,179,216,252,237,110,195,36,103,247,192,150,51,108,136,187,111,211,116,145,166,12,223,25,84,158,224,107,74,146,169,124,121,255,66,187,84,13,41,2,42,195,180,192,205,226,26,170,9,12,168,178,38,103,16,21,173,197,118,59,245,227,89,103,53,173,248,102,112,184,225,230,136,152,40,94,33,232,33,46,248,49,64,51,180,128,251,238,156,152,168,129,244,227,18,136,231,167,141,210,142,29,121,113,222,118,61,45,218,0,113,154,184,169,61,92,97,33,155,75,44,131,253,72,186,31,136,167,22,183,82,79,146,194,53,131,219,207,236,108,92,52,15,230,244,226,38,153,0,127,154,135,122,123,247,97,179,128,117,73,177,15,174,198,45,23,61,108,227,181,113,150,18,173,175,97,246,245,51,19,78,231,163,228,253,206,84,54,238,234,134,245,16,91,11,63,81,148,55,
71,87,67,232,159,109,211,31,137,203,41,121,67,3,96,177,96,85,154,110,56,151,57,111,129,88,10,35,204,235,32,222,162,56,225,166,91,148,46,235,179,114,60,150,32,46,195,217,207,75,246,174,139,27,42,98,135,5,210,213,9,187,57,152,22,58,66,250,128,175,4,29,73,107,190,190,231,49,0,197,52,126,211,247,159,54,223,237,172,109,18,92,186,148,200,199,205,100,230,235,142,56,171,172,251,28,247,122,237,118,192,58,46,47,154,19,55,31,161,233,103,208,217,253,127,0,51,64,48,144,
topic "Design decisions and tradeoffs";[2 $$0,0#00000000000000000000000000000000:Default]
[l288;i704;a17;O9;~~~.992;2 $$1,0#10431211400427159095818037425705:param]
[a83;*R6 $$2,5#31310162474203024125188417583966:caption]
[b83;*2 $$3,5#07864147445237544204411237157677:title]
[i288;b167;a42;O9;C2 $$4,6#40027414424643823182269349404212:item]
[b42;a42;2 $$5,5#45413000475342174754091244180557:text]
[l288;a17;2 $$6,6#27521748481378242620020725143825:desc]
[l321;t246;C@5;1 $$7,7#20902679421464641399138805415013:code]
[b2503;2 $$8,0#65142375456100023862071332075487:separator]
[*@(0.0.255)2 $$9,0#83433469410354161042741608181528:base]
[t4167;C2 $$10,0#37138531426314131251341829483380:class]
[l288;a17;*1 $$11,11#70004532496200323422659154056402:requirement]
[i417;b42;a42;O9;~~~.416;2 $$12,12#10566046415157235020018451313112:tparam]
[b167;C2 $$13,13#92430459443460461911108080531343:item1]
[i288;a42;O9;C2 $$14,14#77422149456609303542238260500223:item2]
[*@2$(0.128.128)2 $$15,15#34511555403152284025741354420178:NewsDate]
[l321;*C$7;2 $$16,16#03451589433145915344929335295360:result]
[l321;b83;a83;*C$7;2 $$17,17#07531550463529505371228428965313:result`-line]
[l160;t4167;*C+117 $$18,5#88603949442205825958800053222425:package`-title]
[{_}%EN-US
[s2; Design decisions and trade`-offs&]
[s0;i150;b33;O0; At the moment, we strongly favor static linking
of U`+`+ packages. If nothing else, it makes U`+`+ apps self`-contained
(together with system of .lay and .iml files) and also much faster
to load (and run) in Linux (just compare start times of UWord
with some KDE based word`-processor). Shared builds were implemented
mainly to improve build times in debug mode.&]
[s0;i150;b33;O0; CPU has to be either little`-endian or big`-endian
(exotic architectures are not supported), in flat 32`-bit mode
or in 64`-bit mode with sizeof(int) >`= 4 (that is quite standard).
Currently tested CPU architectures are i386, AMD64, ARM and PowerPC.&]
[s0;i150;b33;O0; CPU and compiler are supposed to support [^topic`:`/`/Core`/srcdoc`/Moveable`$en`-us^ M
oveable] (true for any gcc platform and MSVC`+`+ as well).&]
[s0;i150;b33;O0; We decided to ignore possibility of `"out`-of`-memory`"
exceptions and recovery. If U`+`+ application goes out of memory,
it simply prints the error message and terminates. This is quite
pragmatic resolution `- our experience is that it is quite hard
and annoying to achieve robustness here and it cannot be reliably
tested. Also, most platforms with virtual memory will almost
freeze long before out`-of`-memory problem due to intensive page
swapping. Connected issue `- default and copy constructors are
not allowed to throw exceptions in U`+`+ (the common reason to
throw exception here was out`-of`-memory condition). This limitation
will be removed in future releases.&]
[s0;i150;b33;O0; Maximum number of elements in any of U`+`+ containers
(including GUI elements, like number of rows in DropList) is
2[` 31 ]`- 1 `= [%00-00 2,147,483,647.]&]
[s0;i150;b33;O0; GUI is single threaded. That does not mean you cannot
do multi`-threaded GUI apps `- just use only one thread to perform
GUI and communicate with others via timer queue (We guess this
method is far safer anyway).&]
[s0;i150;b33;O0; U`+`+ does not use OS`-native widgets. The main
reason for this is to achieve widget interface model optimal
for rapid development. The less important reason is that this
way it is much easier to make U`+`+ cross`-platform. On the other
hand, Chameleon skinning system achieves native look`&feel, so
there is a little perceivable difference for end user.&]
[s0; ]

View file

@ -253,15 +253,37 @@ String AsHtml(const RichTxt& text, const RichStyles& styles, Index<String>& css,
else
lnk = links[q];
}
if(!lnk.IsEmpty() && lnk[0] != ':')
String endtag;
if(!lnk.IsEmpty() && lnk[0] != ':') {
html << "<A HREF=\"" << lnk << "\">";
endtag = "</A>";
}
String cs;
if(part.text[0] != 9)
cs = HtmlCharStyle(part.format, p.format);
if(!cs.IsEmpty())
if(!cs.IsEmpty()) {
html << "<SPAN" << FormatClass(css, cs) << ">";
endtag = "</SPAN>" + endtag;
}
if(part.format.sscript == 1) {
html << "<SUP>";
endtag = "</SUP>" + endtag;
}
if(part.format.sscript == 2) {
html << "<SUB>";
endtag = "</SUB>" + endtag;
}
if(part.format.IsStrikeout()) {
html << "<STRIKE>";
endtag = "</STRIKE>" + endtag;
}
if(part.format.capitals) {
html << "<SPAN STYLE=\"font-variant: small-caps;\">";
endtag << "</SPAN>";
}
bool spc = false;
for(const wchar *s = part.text.Begin(); s != part.text.End(); s++) {
const wchar *end = part.text.End();
for(const wchar *s = part.text.Begin(); s != end; s++) {
if(*s == ' ') {
html.Cat(spc ? "&nbsp;" : " ");
spc = true;
@ -298,10 +320,7 @@ String AsHtml(const RichTxt& text, const RichStyles& styles, Index<String>& css,
html.Cat(ToUtf8(*s));
}
}
if(!cs.IsEmpty())
html << "</SPAN>";
if(!lnk.IsEmpty())
html << "</A>";
html << endtag;
}
}
if(p.part.GetCount() == 0)