diff options
author | Karl <karl@scowencomputers.co.nz> | 2020-01-07 10:26:45 +0300 |
---|---|---|
committer | Karl <contact@scowencomputers.co.nz> | 2020-01-13 07:54:00 +0300 |
commit | c41ee8050ecb4fc38c2238a09b5aa3f58da8e60a (patch) | |
tree | 50ca45c4d3df0c3e5779e974323dd40ef98bcc88 /mcs/class | |
parent | 9b87a23ee663efef14e32ab14cad434cba07b7e0 (diff) |
Improve font name and charset handling.
- Use alternative names as a fallback if present.
- Use the untagged name (\fname, name that doesn't
identify charset ) if present.
- Use font codepage or charset correctly to get the correct encoding.
Rip out the old nonfunctional RTF charset handling.
This was not used, and furthermore was fundamentally flawed.
I have replaced it by simply using the correct text Encoding, mentioned
above.
Diffstat (limited to 'mcs/class')
14 files changed, 198 insertions, 1924 deletions
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/Charcode.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/Charcode.cs deleted file mode 100644 index fc9ca63b12e..00000000000 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/Charcode.cs +++ /dev/null @@ -1,413 +0,0 @@ -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// Copyright (c) 2005 Novell, Inc. (http://www.novell.com) -// -// Authors: -// Peter Bartok (pbartok@novell.com) -// -// - -// COMPLETE - -using System.Collections; - -namespace System.Windows.Forms.RTF { - internal class Charcode { - #region Local Variables - private StandardCharCode[] codes; - private Hashtable reverse; - private int size; - #endregion // Local Variables - - #region Cached Values - static Charcode ansi_generic; - #endregion - - #region Public Constructors - public Charcode() : this(256) { - } - - private Charcode(int size) { - this.size = size; - this.codes = new StandardCharCode[size]; - this.reverse = new Hashtable(size); - - // No need to reinitialize array to its default value - //for (int i = 0; i < size; i++) { - // codes[i] = StandardCharCode.nothing; - //} - } - #endregion // Public Constructors - - #region Public Instance Properties - public int this[StandardCharCode c] { - get { - object obj; - - obj = reverse[c]; - if (obj != null) { - return (int)obj; - } - for (int i = 0; i < size; i++) { - if (codes[i] == c) { - return i; - } - } - - return -1; - } - } - - public StandardCharCode this[int c] { - get { - if (c < 0 || c >= size) { - return StandardCharCode.nothing; - } - - return codes[c]; - } - - private set { - if (c < 0 || c >= size) { - return; - } - - codes[c] = value; - reverse[value] = c; - } - } - #endregion // Public Instance Properties - - #region Public Instance Methods - #endregion // Public Instance Methods - - #region Public Static Methods - public static Charcode AnsiGeneric { - get { - if (ansi_generic != null) - return ansi_generic; - - ansi_generic = new Charcode(256); - - ansi_generic[0x06] = StandardCharCode.formula; - ansi_generic[0x1e] = StandardCharCode.nobrkhyphen; - ansi_generic[0x1f] = StandardCharCode.opthyphen; - ansi_generic[' '] = StandardCharCode.space; - ansi_generic['!'] = StandardCharCode.exclam; - ansi_generic['"'] = StandardCharCode.quotedbl; - ansi_generic['#'] = StandardCharCode.numbersign; - ansi_generic['$'] = StandardCharCode.dollar; - ansi_generic['%'] = StandardCharCode.percent; - ansi_generic['&'] = StandardCharCode.ampersand; - ansi_generic['\\'] = StandardCharCode.quoteright; - ansi_generic['('] = StandardCharCode.parenleft; - ansi_generic[')'] = StandardCharCode.parenright; - ansi_generic['*'] = StandardCharCode.asterisk; - ansi_generic['+'] = StandardCharCode.plus; - ansi_generic[','] = StandardCharCode.comma; - ansi_generic['-'] = StandardCharCode.hyphen; - ansi_generic['.'] = StandardCharCode.period; - ansi_generic['/'] = StandardCharCode.slash; - ansi_generic['0'] = StandardCharCode.zero; - ansi_generic['1'] = StandardCharCode.one; - ansi_generic['2'] = StandardCharCode.two; - ansi_generic['3'] = StandardCharCode.three; - ansi_generic['4'] = StandardCharCode.four; - ansi_generic['5'] = StandardCharCode.five; - ansi_generic['6'] = StandardCharCode.six; - ansi_generic['7'] = StandardCharCode.seven; - ansi_generic['8'] = StandardCharCode.eight; - ansi_generic['9'] = StandardCharCode.nine; - ansi_generic[':'] = StandardCharCode.colon; - ansi_generic[';'] = StandardCharCode.semicolon; - ansi_generic['<'] = StandardCharCode.less; - ansi_generic['='] = StandardCharCode.equal; - ansi_generic['>'] = StandardCharCode.greater; - ansi_generic['?'] = StandardCharCode.question; - ansi_generic['@'] = StandardCharCode.at; - ansi_generic['A'] = StandardCharCode.A; - ansi_generic['B'] = StandardCharCode.B; - ansi_generic['C'] = StandardCharCode.C; - ansi_generic['D'] = StandardCharCode.D; - ansi_generic['E'] = StandardCharCode.E; - ansi_generic['F'] = StandardCharCode.F; - ansi_generic['G'] = StandardCharCode.G; - ansi_generic['H'] = StandardCharCode.H; - ansi_generic['I'] = StandardCharCode.I; - ansi_generic['J'] = StandardCharCode.J; - ansi_generic['K'] = StandardCharCode.K; - ansi_generic['L'] = StandardCharCode.L; - ansi_generic['M'] = StandardCharCode.M; - ansi_generic['N'] = StandardCharCode.N; - ansi_generic['O'] = StandardCharCode.O; - ansi_generic['P'] = StandardCharCode.P; - ansi_generic['Q'] = StandardCharCode.Q; - ansi_generic['R'] = StandardCharCode.R; - ansi_generic['S'] = StandardCharCode.S; - ansi_generic['T'] = StandardCharCode.T; - ansi_generic['U'] = StandardCharCode.U; - ansi_generic['V'] = StandardCharCode.V; - ansi_generic['W'] = StandardCharCode.W; - ansi_generic['X'] = StandardCharCode.X; - ansi_generic['Y'] = StandardCharCode.Y; - ansi_generic['Z'] = StandardCharCode.Z; - ansi_generic['['] = StandardCharCode.bracketleft; - ansi_generic['\\'] = StandardCharCode.backslash; - ansi_generic[']'] = StandardCharCode.bracketright; - ansi_generic['^'] = StandardCharCode.asciicircum; - ansi_generic['_'] = StandardCharCode.underscore; - ansi_generic['`'] = StandardCharCode.quoteleft; - ansi_generic['a'] = StandardCharCode.a; - ansi_generic['b'] = StandardCharCode.b; - ansi_generic['c'] = StandardCharCode.c; - ansi_generic['d'] = StandardCharCode.d; - ansi_generic['e'] = StandardCharCode.e; - ansi_generic['f'] = StandardCharCode.f; - ansi_generic['g'] = StandardCharCode.g; - ansi_generic['h'] = StandardCharCode.h; - ansi_generic['i'] = StandardCharCode.i; - ansi_generic['j'] = StandardCharCode.j; - ansi_generic['k'] = StandardCharCode.k; - ansi_generic['l'] = StandardCharCode.l; - ansi_generic['m'] = StandardCharCode.m; - ansi_generic['n'] = StandardCharCode.n; - ansi_generic['o'] = StandardCharCode.o; - ansi_generic['p'] = StandardCharCode.p; - ansi_generic['q'] = StandardCharCode.q; - ansi_generic['r'] = StandardCharCode.r; - ansi_generic['s'] = StandardCharCode.s; - ansi_generic['t'] = StandardCharCode.t; - ansi_generic['u'] = StandardCharCode.u; - ansi_generic['v'] = StandardCharCode.v; - ansi_generic['w'] = StandardCharCode.w; - ansi_generic['x'] = StandardCharCode.x; - ansi_generic['y'] = StandardCharCode.y; - ansi_generic['z'] = StandardCharCode.z; - ansi_generic['{'] = StandardCharCode.braceleft; - ansi_generic['|'] = StandardCharCode.bar; - ansi_generic['}'] = StandardCharCode.braceright; - ansi_generic['~'] = StandardCharCode.asciitilde; - ansi_generic[0xa0] = StandardCharCode.nobrkspace; - ansi_generic[0xa1] = StandardCharCode.exclamdown; - ansi_generic[0xa2] = StandardCharCode.cent; - ansi_generic[0xa3] = StandardCharCode.sterling; - ansi_generic[0xa4] = StandardCharCode.currency; - ansi_generic[0xa5] = StandardCharCode.yen; - ansi_generic[0xa6] = StandardCharCode.brokenbar; - ansi_generic[0xa7] = StandardCharCode.section; - ansi_generic[0xa8] = StandardCharCode.dieresis; - ansi_generic[0xa9] = StandardCharCode.copyright; - ansi_generic[0xaa] = StandardCharCode.ordfeminine; - ansi_generic[0xab] = StandardCharCode.guillemotleft; - ansi_generic[0xac] = StandardCharCode.logicalnot; - ansi_generic[0xad] = StandardCharCode.opthyphen; - ansi_generic[0xae] = StandardCharCode.registered; - ansi_generic[0xaf] = StandardCharCode.macron; - ansi_generic[0xb0] = StandardCharCode.degree; - ansi_generic[0xb1] = StandardCharCode.plusminus; - ansi_generic[0xb2] = StandardCharCode.twosuperior; - ansi_generic[0xb3] = StandardCharCode.threesuperior; - ansi_generic[0xb4] = StandardCharCode.acute; - ansi_generic[0xb5] = StandardCharCode.mu; - ansi_generic[0xb6] = StandardCharCode.paragraph; - ansi_generic[0xb7] = StandardCharCode.periodcentered; - ansi_generic[0xb8] = StandardCharCode.cedilla; - ansi_generic[0xb9] = StandardCharCode.onesuperior; - ansi_generic[0xba] = StandardCharCode.ordmasculine; - ansi_generic[0xbb] = StandardCharCode.guillemotright; - ansi_generic[0xbc] = StandardCharCode.onequarter; - ansi_generic[0xbd] = StandardCharCode.onehalf; - ansi_generic[0xbe] = StandardCharCode.threequarters; - ansi_generic[0xbf] = StandardCharCode.questiondown; - ansi_generic[0xc0] = StandardCharCode.Agrave; - ansi_generic[0xc1] = StandardCharCode.Aacute; - ansi_generic[0xc2] = StandardCharCode.Acircumflex; - ansi_generic[0xc3] = StandardCharCode.Atilde; - ansi_generic[0xc4] = StandardCharCode.Adieresis; - ansi_generic[0xc5] = StandardCharCode.Aring; - ansi_generic[0xc6] = StandardCharCode.AE; - ansi_generic[0xc7] = StandardCharCode.Ccedilla; - ansi_generic[0xc8] = StandardCharCode.Egrave; - ansi_generic[0xc9] = StandardCharCode.Eacute; - ansi_generic[0xca] = StandardCharCode.Ecircumflex; - ansi_generic[0xcb] = StandardCharCode.Edieresis; - ansi_generic[0xcc] = StandardCharCode.Igrave; - ansi_generic[0xcd] = StandardCharCode.Iacute; - ansi_generic[0xce] = StandardCharCode.Icircumflex; - ansi_generic[0xcf] = StandardCharCode.Idieresis; - ansi_generic[0xd0] = StandardCharCode.Eth; - ansi_generic[0xd1] = StandardCharCode.Ntilde; - ansi_generic[0xd2] = StandardCharCode.Ograve; - ansi_generic[0xd3] = StandardCharCode.Oacute; - ansi_generic[0xd4] = StandardCharCode.Ocircumflex; - ansi_generic[0xd5] = StandardCharCode.Otilde; - ansi_generic[0xd6] = StandardCharCode.Odieresis; - ansi_generic[0xd7] = StandardCharCode.multiply; - ansi_generic[0xd8] = StandardCharCode.Oslash; - ansi_generic[0xd9] = StandardCharCode.Ugrave; - ansi_generic[0xda] = StandardCharCode.Uacute; - ansi_generic[0xdb] = StandardCharCode.Ucircumflex; - ansi_generic[0xdc] = StandardCharCode.Udieresis; - ansi_generic[0xdd] = StandardCharCode.Yacute; - ansi_generic[0xde] = StandardCharCode.Thorn; - ansi_generic[0xdf] = StandardCharCode.germandbls; - ansi_generic[0xe0] = StandardCharCode.agrave; - ansi_generic[0xe1] = StandardCharCode.aacute; - ansi_generic[0xe2] = StandardCharCode.acircumflex; - ansi_generic[0xe3] = StandardCharCode.atilde; - ansi_generic[0xe4] = StandardCharCode.adieresis; - ansi_generic[0xe5] = StandardCharCode.aring; - ansi_generic[0xe6] = StandardCharCode.ae; - ansi_generic[0xe7] = StandardCharCode.ccedilla; - ansi_generic[0xe8] = StandardCharCode.egrave; - ansi_generic[0xe9] = StandardCharCode.eacute; - ansi_generic[0xea] = StandardCharCode.ecircumflex; - ansi_generic[0xeb] = StandardCharCode.edieresis; - ansi_generic[0xec] = StandardCharCode.igrave; - ansi_generic[0xed] = StandardCharCode.iacute; - ansi_generic[0xee] = StandardCharCode.icircumflex; - ansi_generic[0xef] = StandardCharCode.idieresis; - ansi_generic[0xf0] = StandardCharCode.eth; - ansi_generic[0xf1] = StandardCharCode.ntilde; - ansi_generic[0xf2] = StandardCharCode.ograve; - ansi_generic[0xf3] = StandardCharCode.oacute; - ansi_generic[0xf4] = StandardCharCode.ocircumflex; - ansi_generic[0xf5] = StandardCharCode.otilde; - ansi_generic[0xf6] = StandardCharCode.odieresis; - ansi_generic[0xf7] = StandardCharCode.divide; - ansi_generic[0xf8] = StandardCharCode.oslash; - ansi_generic[0xf9] = StandardCharCode.ugrave; - ansi_generic[0xfa] = StandardCharCode.uacute; - ansi_generic[0xfb] = StandardCharCode.ucircumflex; - ansi_generic[0xfc] = StandardCharCode.udieresis; - ansi_generic[0xfd] = StandardCharCode.yacute; - ansi_generic[0xfe] = StandardCharCode.thorn; - ansi_generic[0xff] = StandardCharCode.ydieresis; - - return ansi_generic; - } - } - - public static Charcode AnsiSymbol { - get { - Charcode code = new Charcode(256); - - code[0x06] = StandardCharCode.formula; - code[0x1e] = StandardCharCode.nobrkhyphen; - code[0x1f] = StandardCharCode.opthyphen; - code[' '] = StandardCharCode.space; - code['!'] = StandardCharCode.exclam; - code['"'] = StandardCharCode.universal; - code['#'] = StandardCharCode.mathnumbersign; - code['$'] = StandardCharCode.existential; - code['%'] = StandardCharCode.percent; - code['&'] = StandardCharCode.ampersand; - code['\\'] = StandardCharCode.suchthat; - code['('] = StandardCharCode.parenleft; - code[')'] = StandardCharCode.parenright; - code['*'] = StandardCharCode.mathasterisk; - code['+'] = StandardCharCode.mathplus; - code[','] = StandardCharCode.comma; - code['-'] = StandardCharCode.mathminus; - code['.'] = StandardCharCode.period; - code['/'] = StandardCharCode.slash; - code['0'] = StandardCharCode.zero; - code['1'] = StandardCharCode.one; - code['2'] = StandardCharCode.two; - code['3'] = StandardCharCode.three; - code['4'] = StandardCharCode.four; - code['5'] = StandardCharCode.five; - code['6'] = StandardCharCode.six; - code['7'] = StandardCharCode.seven; - code['8'] = StandardCharCode.eight; - code['9'] = StandardCharCode.nine; - code[':'] = StandardCharCode.colon; - code[';'] = StandardCharCode.semicolon; - code['<'] = StandardCharCode.less; - code['='] = StandardCharCode.mathequal; - code['>'] = StandardCharCode.greater; - code['?'] = StandardCharCode.question; - code['@'] = StandardCharCode.congruent; - code['A'] = StandardCharCode.Alpha; - code['B'] = StandardCharCode.Beta; - code['C'] = StandardCharCode.Chi; - code['D'] = StandardCharCode.Delta; - code['E'] = StandardCharCode.Epsilon; - code['F'] = StandardCharCode.Phi; - code['G'] = StandardCharCode.Gamma; - code['H'] = StandardCharCode.Eta; - code['I'] = StandardCharCode.Iota; - code['K'] = StandardCharCode.Kappa; - code['L'] = StandardCharCode.Lambda; - code['M'] = StandardCharCode.Mu; - code['N'] = StandardCharCode.Nu; - code['O'] = StandardCharCode.Omicron; - code['P'] = StandardCharCode.Pi; - code['Q'] = StandardCharCode.Theta; - code['R'] = StandardCharCode.Rho; - code['S'] = StandardCharCode.Sigma; - code['T'] = StandardCharCode.Tau; - code['U'] = StandardCharCode.Upsilon; - code['V'] = StandardCharCode.varsigma; - code['W'] = StandardCharCode.Omega; - code['X'] = StandardCharCode.Xi; - code['Y'] = StandardCharCode.Psi; - code['Z'] = StandardCharCode.Zeta; - code['['] = StandardCharCode.bracketleft; - code['\\'] = StandardCharCode.backslash; - code[']'] = StandardCharCode.bracketright; - code['^'] = StandardCharCode.asciicircum; - code['_'] = StandardCharCode.underscore; - code['`'] = StandardCharCode.quoteleft; - code['a'] = StandardCharCode.alpha; - code['b'] = StandardCharCode.beta; - code['c'] = StandardCharCode.chi; - code['d'] = StandardCharCode.delta; - code['e'] = StandardCharCode.epsilon; - code['f'] = StandardCharCode.phi; - code['g'] = StandardCharCode.gamma; - code['h'] = StandardCharCode.eta; - code['i'] = StandardCharCode.iota; - code['k'] = StandardCharCode.kappa; - code['l'] = StandardCharCode.lambda; - code['m'] = StandardCharCode.mu; - code['n'] = StandardCharCode.nu; - code['o'] = StandardCharCode.omicron; - code['p'] = StandardCharCode.pi; - code['q'] = StandardCharCode.theta; - code['r'] = StandardCharCode.rho; - code['s'] = StandardCharCode.sigma; - code['t'] = StandardCharCode.tau; - code['u'] = StandardCharCode.upsilon; - code['w'] = StandardCharCode.omega; - code['x'] = StandardCharCode.xi; - code['y'] = StandardCharCode.psi; - code['z'] = StandardCharCode.zeta; - code['{'] = StandardCharCode.braceleft; - code['|'] = StandardCharCode.bar; - code['}'] = StandardCharCode.braceright; - code['~'] = StandardCharCode.mathtilde; - - return code; - } - } - #endregion // Public Static Methods - } -} diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/Charset.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/Charset.cs deleted file mode 100644 index cba57819595..00000000000 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/Charset.cs +++ /dev/null @@ -1,157 +0,0 @@ -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// Copyright (c) 2005 Novell, Inc. (http://www.novell.com) -// -// Authors: -// Peter Bartok (pbartok@novell.com) -// -// - -using System; - -// COMPLETE - -namespace System.Windows.Forms.RTF { - -#if RTF_LIB - public -#else - internal -#endif - class Charset { - #region Local Variables - private CharsetType id; - private CharsetFlags flags; - private Charcode code; - private string file; - #endregion // Local Variables - - #region Public Constructors - public Charset() { - flags = CharsetFlags.Read | CharsetFlags.Switch; - id = CharsetType.General; - file = string.Empty; - this.ReadMap(); - } - #endregion // Public Constructors - - #region Public Instance Properties - public Charcode Code { - get { - return code; - } - - set { - code = value; - } - } - - public CharsetFlags Flags { - get { - return flags; - } - - set { - flags = value; - } - } - - public CharsetType ID { - get { - return id; - } - - set { - switch(value) { - case CharsetType.Symbol: { - id = CharsetType.Symbol; - return; - } - - default: - case CharsetType.General: { - id = CharsetType.General; - return; - } - } - } - } - - public string File { - get { - return file; - } - - set { - if (file != value) { - file = value; - } - } - } - - public StandardCharCode this[int c] { - get { - return code[c]; - } - } - - #endregion // Public Instance Properties - - #region Public Instance Methods - public bool ReadMap() { - switch (id) { - case CharsetType.General: { - if (file == string.Empty) { - code = Charcode.AnsiGeneric; - return true; - } - // FIXME - implement reading charmap from file... - return true; - } - - case CharsetType.Symbol: { - if (file == string.Empty) { - code = Charcode.AnsiSymbol; - return true; - } - - // FIXME - implement reading charmap from file... - return true; - } - - default: { - return false; - } - } - } - - public char StdCharCode(string name) { - // FIXME - finish this - return ' '; - - } - - public string StdCharName(char code) { - // FIXME - finish this - return String.Empty; - } - #endregion // Public Instance Methods - } -} diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/CharsetFlags.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/CharsetFlags.cs deleted file mode 100644 index 7cfcb8c6539..00000000000 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/CharsetFlags.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// Copyright (c) 2005 Novell, Inc. (http://www.novell.com) -// -// Authors: -// Peter Bartok (pbartok@novell.com) -// -// - -// COMPLETE - -namespace System.Windows.Forms.RTF { - [Flags] -#if RTF_LIB - public -#else - internal -#endif - enum CharsetFlags { - None = 0x00, - Read = 0x01, - Switch = 0x02 - } -} diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/CharsetToCodepage.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/CharsetToCodepage.cs new file mode 100644 index 00000000000..1c7b3534fc2 --- /dev/null +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/CharsetToCodepage.cs @@ -0,0 +1,77 @@ +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Copyright (c) 2020 Karl Scowen +// +// Authors: +// Karl Scowen <contact@scowencomputers.co.nz> +// +// + + +namespace System.Windows.Forms.RTF { + internal static class CharsetToCodepage { + public static int Translate(CharsetType charset) { + switch (charset) { + case CharsetType.ANSI: + case CharsetType.General: + case CharsetType.Arabic_Traditional: + case CharsetType.Arabic_user: + case CharsetType.Hebrew_user: + case CharsetType.Mac: // Technically wrong, because "mac" should actually be quite a few with their own code pages... + default: + return 1252; + case CharsetType.Symbol: + return 42; + case CharsetType.Shift_Jis: + return 932; + case CharsetType.Hangul: + return 949; + case CharsetType.Johab: + return 1361; + case CharsetType.GB2312: + return 936; + case CharsetType.Big5: + return 950; + case CharsetType.Greek: + return 1253; + case CharsetType.Turkish: + return 1254; + case CharsetType.Vietnamese: + return 1258; + case CharsetType.Hebrew: + return 1255; + case CharsetType.Arabic: + return 1256; + case CharsetType.Baltic: + return 1257; + case CharsetType.Russian: + return 1251; + case CharsetType.Thai: + return 874; + case CharsetType.Eastern_European: + return 1250; + case CharsetType.PC_437: + return 437; + case CharsetType.OEM: + return 850; + } + } + } +}
\ No newline at end of file diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/CharsetType.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/CharsetType.cs index a934dc82869..4dbb3d94897 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/CharsetType.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/CharsetType.cs @@ -21,6 +21,7 @@ // // Authors: // Peter Bartok (pbartok@novell.com) +// Karl Scowen (contact@scowencomputers.co.nz) // // @@ -33,8 +34,29 @@ namespace System.Windows.Forms.RTF { #else internal #endif - enum CharsetType { - General = 0, - Symbol = 1, + enum CharsetType : byte { + ANSI = 0, + General = 1, + Symbol = 2, + Mac = 77, + Shift_Jis = 128, + Hangul = 129, + Johab = 130, + GB2312 = 134, + Big5 = 136, + Greek = 161, + Turkish = 162, + Vietnamese = 163, + Hebrew = 177, + Arabic = 178, + Arabic_Traditional = 179, + Arabic_user = 180, + Hebrew_user = 181, + Baltic = 186, + Russian = 204, + Thai = 222, + Eastern_European = 238, + PC_437 = 254, + OEM = 255 } } diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/KeysInit.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/KeysInit.cs index 3dbfed122eb..5ff3ff426c6 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/KeysInit.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/KeysInit.cs @@ -395,6 +395,7 @@ namespace System.Windows.Forms.RTF { new KeyStruct(Major.NeXTGrAttr, Minor.NeXTGHeight, "height"), new KeyStruct(Major.Destination, Minor.OptDest, "*"), new KeyStruct(Major.Destination, Minor.FontTbl, "fonttbl"), + new KeyStruct(Major.Destination, Minor.FontName, "fname"), new KeyStruct(Major.Destination, Minor.FontAltName, "falt"), new KeyStruct(Major.Destination, Minor.EmbeddedFont, "fonteb"), new KeyStruct(Major.Destination, Minor.FontFile, "fontfile"), diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/Minor.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/Minor.cs index e057fcfb525..4033f5bbf24 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/Minor.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/Minor.cs @@ -41,6 +41,7 @@ namespace System.Windows.Forms.RTF { // Major.Destinan FontTbl, + FontName, FontAltName, EmbeddedFont, FontFile, diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/RTF.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/RTF.cs index c2c333dc07a..181dd971c13 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/RTF.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/RTF.cs @@ -60,10 +60,7 @@ namespace System.Windows.Forms.RTF { private char prev_char; private bool bump_line; - - private Font font_list; - - private Charset cur_charset; + private Stack charset_stack; private Style styles; @@ -101,10 +98,6 @@ namespace System.Windows.Forms.RTF { line_pos = 0; prev_char = unchecked((char)-1); bump_line = false; - font_list = null; - charset_stack = null; - - cur_charset = new Charset(); destination_callbacks = new DestinationCallback(); class_callbacks = new ClassCallback(); @@ -369,49 +362,52 @@ SkipCRLF: GetToken2(); if (this.rtf_class == TokenClass.Text) { - this.minor = (Minor)this.cur_charset[(int)this.major]; - if (encoding == null) { + if (encoding == null) encoding = Encoding.GetEncoding (encoding_code_page); - } encoded_text = new String (encoding.GetChars (new byte [] { (byte) this.major })); - } - - if (this.cur_charset.Flags == CharsetFlags.None) { - return this.rtf_class; - } - - if (CheckCMM (TokenClass.Control, Major.Unicode, Minor.UnicodeAnsiCodepage)) { + } else if (CheckCMM (TokenClass.Control, Major.Unicode, Minor.UnicodeAnsiCodepage)) { encoding_code_page = param; // fallback to the default one in case we have an invalid value if (encoding_code_page < 0 || encoding_code_page > 65535) encoding_code_page = DefaultEncodingCodePage; - } - if (((this.cur_charset.Flags & CharsetFlags.Read) != 0) && CheckCM(TokenClass.Control, Major.CharSet)) { - this.cur_charset.ReadMap(); - } else if (((this.cur_charset.Flags & CharsetFlags.Switch) != 0) && CheckCMM(TokenClass.Control, Major.CharAttr, Minor.FontNum)) { + encoding = null; + } else if (CheckCMM(TokenClass.Control, Major.CharAttr, Minor.FontNum)) { Font fp; - fp = Font.GetFont(this.font_list, this.param); + fp = Font.GetFont(this.fonts, this.param); if (fp != null) { - if (fp.Name.StartsWith("Symbol")) { - this.cur_charset.ID = CharsetType.Symbol; + if (fp.Codepage != 0) { + if (fp.Codepage != encoding_code_page) { + encoding_code_page = fp.Codepage; + encoding = null; + } } else { - this.cur_charset.ID = CharsetType.General; - } - } else if (((this.cur_charset.Flags & CharsetFlags.Switch) != 0) && (this.rtf_class == TokenClass.Group)) { - switch(this.major) { - case Major.BeginGroup: { - this.charset_stack.Push(this.cur_charset); - break; + var cp = CharsetToCodepage.Translate(fp.Charset); + if (cp != 0 && cp != encoding_code_page) { + encoding_code_page = cp; + encoding = null; } + } + } + } else if (this.rtf_class == TokenClass.Group) { + switch(this.major) { + case Major.BeginGroup: { + charset_stack.Push(encoding); + break; + } - case Major.EndGroup: { - this.cur_charset = (Charset)this.charset_stack.Pop(); - break; + case Major.EndGroup: { + if (charset_stack.Count > 0) { + encoding = (Encoding)this.charset_stack.Pop(); + encoding_code_page = encoding.CodePage; + } else { + encoding = null; + encoding_code_page = DefaultEncodingCodePage; } + break; } } } @@ -677,8 +673,11 @@ SkipCRLF: font = new Font(rtf); - while ((rtf.rtf_class != TokenClass.EOF) && (!rtf.CheckCM(TokenClass.Text, (Major)';')) && (!rtf.CheckCM(TokenClass.Group, Major.EndGroup))) { - if (rtf.rtf_class == TokenClass.Control) { + int depth = 0; + string untaggedName = null; + + while ((rtf.rtf_class != TokenClass.EOF) && (!rtf.CheckCM(TokenClass.Text, (Major)';')) && depth >= 0) { + if (rtf.rtf_class == TokenClass.Control) { switch(rtf.major) { case Major.FontFamily: { font.Family = (int)rtf.minor; @@ -734,6 +733,26 @@ SkipCRLF: break; } + case Major.Destination: { + switch (rtf.minor) { + case Minor.FontName: + untaggedName = ReadFontName(rtf); + break; + + case Minor.FontAltName: + font.AltName = ReadFontName(rtf); + break; + + default: { + #if RTF_DEBUG + Console.WriteLine("Got unhandled Control.Destination.Minor: " + rtf.minor); + #endif + break; + } + } + break; + } + default: { #if RTF_DEBUG Console.WriteLine("ReadFontTbl: Unknown Control token " + rtf.major); @@ -742,32 +761,25 @@ SkipCRLF: } } } else if (rtf.CheckCM(TokenClass.Group, Major.BeginGroup)) { - rtf.SkipGroup(); - } else if (rtf.rtf_class == TokenClass.Text) { - StringBuilder sb; - - sb = new StringBuilder(); - - while ((rtf.rtf_class != TokenClass.EOF) && (!rtf.CheckCM(TokenClass.Text, (Major)';')) && (!rtf.CheckCM(TokenClass.Group, Major.EndGroup)) && (!rtf.CheckCM(TokenClass.Group, Major.BeginGroup))) { - sb.Append((char)rtf.major); - rtf.GetToken(); - } - - if (rtf.CheckCM(TokenClass.Group, Major.EndGroup)) { - rtf.UngetToken(); - } - - font.Name = sb.ToString(); - continue; + depth++; + } else if (rtf.CheckCM(TokenClass.Group, Major.EndGroup)) { + depth--; + } else if (rtf.rtf_class == TokenClass.Text) + { + font.Name = ReadFontName(rtf); + continue; #if RTF_DEBUG } else { Console.WriteLine("ReadFontTbl: Unknown token " + rtf.text_buffer); #endif - } + } - rtf.GetToken(); + rtf.GetToken(); } + if (untaggedName != null) + font.Name = untaggedName; + if (old == 0) { rtf.GetToken(); @@ -788,7 +800,28 @@ SkipCRLF: rtf.RouteToken(); } - private void ReadColorTbl(RTF rtf) { + private static String ReadFontName(RTF rtf) + { + StringBuilder sb = new StringBuilder(); + + while (rtf.rtf_class != TokenClass.EOF && rtf.rtf_class != TokenClass.Text) + rtf.GetToken(); + + while ((rtf.rtf_class != TokenClass.EOF) && (!rtf.CheckCM(TokenClass.Text, (Major)';')) && (!rtf.CheckCM(TokenClass.Group, Major.EndGroup)) && (!rtf.CheckCM(TokenClass.Group, Major.BeginGroup))) + { + sb.Append((char)rtf.major); + rtf.GetToken(); + } + + if (rtf.CheckCM(TokenClass.Group, Major.EndGroup)) + { + rtf.UngetToken(); + } + + return sb.ToString(); + } + + private void ReadColorTbl(RTF rtf) { Color color; int num; diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/StandardCharCode.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/StandardCharCode.cs deleted file mode 100644 index 906735ba181..00000000000 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/StandardCharCode.cs +++ /dev/null @@ -1,392 +0,0 @@ -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// Copyright (c) 2005 Novell, Inc. (http://www.novell.com) -// -// Authors: -// Peter Bartok (pbartok@novell.com) -// -// - -// COMPLETE - -namespace System.Windows.Forms.RTF { - -#if RTF_LIB - public -#else - internal -#endif - enum StandardCharCode { - nothing = 0, - space = 1, - exclam = 2, - quotedbl = 3, - numbersign = 4, - dollar = 5, - percent = 6, - ampersand = 7, - quoteright = 8, - parenleft = 9, - parenright = 10, - asterisk = 11, - plus = 12, - comma = 13, - hyphen = 14, - period = 15, - slash = 16, - zero = 17, - one = 18, - two = 19, - three = 20, - four = 21, - five = 22, - six = 23, - seven = 24, - eight = 25, - nine = 26, - colon = 27, - semicolon = 28, - less = 29, - equal = 30, - greater = 31, - question = 32, - at = 33, - A = 34, - B = 35, - C = 36, - D = 37, - E = 38, - F = 39, - G = 40, - H = 41, - I = 42, - J = 43, - K = 44, - L = 45, - M = 46, - N = 47, - O = 48, - P = 49, - Q = 50, - R = 51, - S = 52, - T = 53, - U = 54, - V = 55, - W = 56, - X = 57, - Y = 58, - Z = 59, - bracketleft = 60, - backslash = 61, - bracketright = 62, - asciicircum = 63, - underscore = 64, - quoteleft = 65, - a = 66, - b = 67, - c = 68, - d = 69, - e = 70, - f = 71, - g = 72, - h = 73, - i = 74, - j = 75, - k = 76, - l = 77, - m = 78, - n = 79, - o = 80, - p = 81, - q = 82, - r = 83, - s = 84, - t = 85, - u = 86, - v = 87, - w = 88, - x = 89, - y = 90, - z = 91, - braceleft = 92, - bar = 93, - braceright = 94, - asciitilde = 95, - exclamdown = 96, - cent = 97, - sterling = 98, - fraction = 99, - yen = 100, - florin = 101, - section = 102, - currency = 103, - quotedblleft = 104, - guillemotleft = 105, - guilsinglleft = 106, - guilsinglright = 107, - fi = 108, - fl = 109, - endash = 110, - dagger = 111, - daggerdbl = 112, - periodcentered = 113, - paragraph = 114, - bullet = 115, - quotesinglbase = 116, - quotedblbase = 117, - quotedblright = 118, - guillemotright = 119, - ellipsis = 120, - perthousand = 121, - questiondown = 122, - grave = 123, - acute = 124, - circumflex = 125, - tilde = 126, - macron = 127, - breve = 128, - dotaccent = 129, - dieresis = 130, - ring = 131, - cedilla = 132, - hungarumlaut = 133, - ogonek = 134, - caron = 135, - emdash = 136, - AE = 137, - ordfeminine = 138, - Lslash = 139, - Oslash = 140, - OE = 141, - ordmasculine = 142, - ae = 143, - dotlessi = 144, - lslash = 145, - oslash = 146, - oe = 147, - germandbls = 148, - Aacute = 149, - Acircumflex = 150, - Adieresis = 151, - Agrave = 152, - Aring = 153, - Atilde = 154, - Ccedilla = 155, - Eacute = 156, - Ecircumflex = 157, - Edieresis = 158, - Egrave = 159, - Eth = 160, - Iacute = 161, - Icircumflex = 162, - Idieresis = 163, - Igrave = 164, - Ntilde = 165, - Oacute = 166, - Ocircumflex = 167, - Odieresis = 168, - Ograve = 169, - Otilde = 170, - Scaron = 171, - Thorn = 172, - Uacute = 173, - Ucircumflex = 174, - Udieresis = 175, - Ugrave = 176, - Yacute = 177, - Ydieresis = 178, - aacute = 179, - acircumflex = 180, - adieresis = 181, - agrave = 182, - aring = 183, - atilde = 184, - brokenbar = 185, - ccedilla = 186, - copyright = 187, - degree = 188, - divide = 189, - eacute = 190, - ecircumflex = 191, - edieresis = 192, - egrave = 193, - eth = 194, - iacute = 195, - icircumflex = 196, - idieresis = 197, - igrave = 198, - logicalnot = 199, - minus = 200, - multiply = 201, - ntilde = 202, - oacute = 203, - ocircumflex = 204, - odieresis = 205, - ograve = 206, - onehalf = 207, - onequarter = 208, - onesuperior = 209, - otilde = 210, - plusminus = 211, - registered = 212, - thorn = 213, - threequarters = 214, - threesuperior = 215, - trademark = 216, - twosuperior = 217, - uacute = 218, - ucircumflex = 219, - udieresis = 220, - ugrave = 221, - yacute = 222, - ydieresis = 223, - Alpha = 224, - Beta = 225, - Chi = 226, - Delta = 227, - Epsilon = 228, - Phi = 229, - Gamma = 230, - Eta = 231, - Iota = 232, - Kappa = 233, - Lambda = 234, - Mu = 235, - Nu = 236, - Omicron = 237, - Pi = 238, - Theta = 239, - Rho = 240, - Sigma = 241, - Tau = 242, - Upsilon = 243, - varUpsilon = 244, - Omega = 245, - Xi = 246, - Psi = 247, - Zeta = 248, - alpha = 249, - beta = 250, - chi = 251, - delta = 252, - epsilon = 253, - phi = 254, - varphi = 255, - gamma = 256, - eta = 257, - iota = 258, - kappa = 259, - lambda = 260, - mu = 261, - nu = 262, - omicron = 263, - pi = 264, - varpi = 265, - theta = 266, - vartheta = 267, - rho = 268, - sigma = 269, - varsigma = 270, - tau = 271, - upsilon = 272, - omega = 273, - xi = 274, - psi = 275, - zeta = 276, - nobrkspace = 277, - nobrkhyphen = 278, - lessequal = 279, - greaterequal = 280, - infinity = 281, - integral = 282, - notequal = 283, - radical = 284, - radicalex = 285, - approxequal = 286, - apple = 287, - partialdiff = 288, - opthyphen = 289, - formula = 290, - lozenge = 291, - universal = 292, - existential = 293, - suchthat = 294, - congruent = 295, - therefore = 296, - perpendicular = 297, - minute = 298, - club = 299, - diamond = 300, - heart = 301, - spade = 302, - arrowboth = 303, - arrowleft = 304, - arrowup = 305, - arrowright = 306, - arrowdown = 307, - second = 308, - proportional = 309, - equivalence = 310, - arrowvertex = 311, - arrowhorizex = 312, - carriagereturn = 313, - aleph = 314, - Ifraktur = 315, - Rfraktur = 316, - weierstrass = 317, - circlemultiply = 318, - circleplus = 319, - emptyset = 320, - intersection = 321, - union = 322, - propersuperset = 323, - reflexsuperset = 324, - notsubset = 325, - propersubset = 326, - reflexsubset = 327, - element = 328, - notelement = 329, - angle = 330, - gradient = 331, - product = 332, - logicaland = 333, - logicalor = 334, - arrowdblboth = 335, - arrowdblleft = 336, - arrowdblup = 337, - arrowdblright = 338, - arrowdbldown = 339, - angleleft = 340, - registersans = 341, - copyrightsans = 342, - trademarksans = 343, - angleright = 344, - mathplus = 345, - mathminus = 346, - mathasterisk = 347, - mathnumbersign = 348, - dotmath = 349, - mathequal = 350, - mathtilde = 351, - - MaxChar = 352 - } -} diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/StandardCharName.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/StandardCharName.cs deleted file mode 100644 index 0190b798cf2..00000000000 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/StandardCharName.cs +++ /dev/null @@ -1,411 +0,0 @@ -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// Copyright (c) 2005 Novell, Inc. (http://www.novell.com) -// -// Authors: -// Peter Bartok (pbartok@novell.com) -// -// - -// COMPLETE - -namespace System.Windows.Forms.RTF { - -#if RTF_LIB - public -#else - internal -#endif - class StandardCharName { - public static string[] Names = { - "nothing", - "space", - "exclam", - "quotedbl", - "numbersign", - "dollar", - "percent", - "ampersand", - "quoteright", - "parenleft", - "parenright", - "asterisk", - "plus", - "comma", - "hyphen", - "period", - "slash", - "zero", - "one", - "two", - "three", - "four", - "five", - "six", - "seven", - "eight", - "nine", - "colon", - "semicolon", - "less", - "equal", - "greater", - "question", - "at", - "A", - "B", - "C", - "D", - "E", - "F", - "G", - "H", - "I", - "J", - "K", - "L", - "M", - "N", - "O", - "P", - "Q", - "R", - "S", - "T", - "U", - "V", - "W", - "X", - "Y", - "Z", - "bracketleft", - "backslash", - "bracketright", - "asciicircum", - "underscore", - "quoteleft", - "a", - "b", - "c", - "d", - "e", - "f", - "g", - "h", - "i", - "j", - "k", - "l", - "m", - "n", - "o", - "p", - "q", - "r", - "s", - "t", - "u", - "v", - "w", - "x", - "y", - "z", - "braceleft", - "bar", - "braceright", - "asciitilde", - "exclamdown", - "cent", - "sterling", - "fraction", - "yen", - "florin", - "section", - "currency", - "quotedblleft", - "guillemotleft", - "guilsinglleft", - "guilsinglright", - "fi", - "fl", - "endash", - "dagger", - "daggerdbl", - "periodcentered", - "paragraph", - "bullet", - "quotesinglbase", - "quotedblbase", - "quotedblright", - "guillemotright", - "ellipsis", - "perthousand", - "questiondown", - "grave", - "acute", - "circumflex", - "tilde", - "macron", - "breve", - "dotaccent", - "dieresis", - "ring", - "cedilla", - "hungarumlaut", - "ogonek", - "caron", - "emdash", - "AE", - "ordfeminine", - "Lslash", - "Oslash", - "OE", - "ordmasculine", - "ae", - "dotlessi", - "lslash", - "oslash", - "oe", - "germandbls", - "Aacute", - "Acircumflex", - "Adieresis", - "Agrave", - "Aring", - "Atilde", - "Ccedilla", - "Eacute", - "Ecircumflex", - "Edieresis", - "Egrave", - "Eth", - "Iacute", - "Icircumflex", - "Idieresis", - "Igrave", - "Ntilde", - "Oacute", - "Ocircumflex", - "Odieresis", - "Ograve", - "Otilde", - "Scaron", - "Thorn", - "Uacute", - "Ucircumflex", - "Udieresis", - "Ugrave", - "Yacute", - "Ydieresis", - "aacute", - "acircumflex", - "adieresis", - "agrave", - "aring", - "atilde", - "brokenbar", - "ccedilla", - "copyright", - "degree", - "divide", - "eacute", - "ecircumflex", - "edieresis", - "egrave", - "eth", - "iacute", - "icircumflex", - "idieresis", - "igrave", - "logicalnot", - "minus", - "multiply", - "ntilde", - "oacute", - "ocircumflex", - "odieresis", - "ograve", - "onehalf", - "onequarter", - "onesuperior", - "otilde", - "plusminus", - "registered", - "thorn", - "threequarters", - "threesuperior", - "trademark", - "twosuperior", - "uacute", - "ucircumflex", - "udieresis", - "ugrave", - "yacute", - "ydieresis", - "Alpha", - "Beta", - "Chi", - "Delta", - "Epsilon", - "Phi", - "Gamma", - "Eta", - "Iota", - "Kappa", - "Lambda", - "Mu", - "Nu", - "Omicron", - "Pi", - "Theta", - "Rho", - "Sigma", - "Tau", - "Upsilon", - "varUpsilon", - "Omega", - "Xi", - "Psi", - "Zeta", - "alpha", - "beta", - "chi", - "delta", - "epsilon", - "phi", - "varphi", - "gamma", - "eta", - "iota", - "kappa", - "lambda", - "mu", - "nu", - "omicron", - "pi", - "varpi", - "theta", - "vartheta", - "rho", - "sigma", - "varsigma", - "tau", - "upsilon", - "omega", - "xi", - "psi", - "zeta", - "nobrkspace", - "nobrkhyphen", - "lessequal", - "greaterequal", - "infinity", - "integral", - "notequal", - "radical", - "radicalex", - "approxequal", - "apple", - "partialdiff", - "opthyphen", - "formula", - "lozenge", - "universal", - "existential", - "suchthat", - "congruent", - "therefore", - "perpendicular", - "minute", - "club", - "diamond", - "heart", - "spade", - "arrowboth", - "arrowleft", - "arrowup", - "arrowright", - "arrowdown", - "second", - "proportional", - "equivalence", - "arrowvertex", - "arrowhorizex", - "carriagereturn", - "aleph", - "Ifraktur", - "Rfraktur", - "weierstrass", - "circlemultiply", - "circleplus", - "emptyset", - "intersection", - "union", - "propersuperset", - "reflexsuperset", - "notsubset", - "propersubset", - "reflexsubset", - "element", - "notelement", - "angle", - "gradient", - "product", - "logicaland", - "logicalor", - "arrowdblboth", - "arrowdblleft", - "arrowdblup", - "arrowdblright", - "arrowdbldown", - "angleleft", - "registersans", - "copyrightsans", - "trademarksans", - "angleright", - "mathplus", - "mathminus", - "mathasterisk", - "mathnumbersign", - "dotmath", - "mathequal", - "mathtilde" - }; - - /// <summary>Lookup name by ID</summary> - public static string Name(int index) { - if ((index < 0) || (index >= Names.Length)) { - return string.Empty; - } - - return Names[index]; - } - - /// <summary>Lookup ID by name (e.g. mathtilde)</summary> - public static int ID(string name) { - for (int i=0; i < Names.Length; i++) { - if (name.Equals(Names[i])) { - return i; - } - } - return 0; - } - } -} diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/TextMap.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/TextMap.cs deleted file mode 100644 index f4474b92627..00000000000 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/TextMap.cs +++ /dev/null @@ -1,440 +0,0 @@ -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// Copyright (c) 2005 Novell, Inc. (http://www.novell.com) -// -// Authors: -// Peter Bartok (pbartok@novell.com) -// -// - -// This map is for convencience only, any app can create/use it's own -// StdCharCode -> <text> table - -using System.Collections; - -namespace System.Windows.Forms.RTF { - -#if RTF_LIB - public -#else - internal -#endif - class TextMap { - #region Local Variables - private string[] table; - #endregion // Local Variables - - #region Public Constructors - public TextMap() { - table = new string[(int)StandardCharCode.MaxChar]; - - for (int i = 0; i < (int)StandardCharCode.MaxChar; i++) { - table[i] = string.Empty; - } - } - #endregion // Public Constructors - - #region Public Instance Properties - internal string this[StandardCharCode c] { // FIXME - this should be public, if the whole namespace was public (ie standalone RTF parser) - get { - return table[(int)c]; - } - - set { - table[(int)c] = value; - } - } - - public string[] Table { - get { - return table; - } - } - #endregion // Public Instance Properties - - #region Public Static Methods - public static void SetupStandardTable(string[] table) - { - /* - table[(int)StandardCharCode.space] = " "; - table[(int)StandardCharCode.exclam] = "!"; - table[(int)StandardCharCode.quotedbl] = "\""; - table[(int)StandardCharCode.numbersign] = "#"; - table[(int)StandardCharCode.dollar] = "$"; - table[(int)StandardCharCode.percent] = "%"; - table[(int)StandardCharCode.ampersand] = "&"; - table[(int)StandardCharCode.quoteright] = "'"; - table[(int)StandardCharCode.parenleft] = "("; - table[(int)StandardCharCode.parenright] = ")"; - table[(int)StandardCharCode.asterisk] = "*"; - table[(int)StandardCharCode.plus] = "+"; - table[(int)StandardCharCode.comma] = ","; - table[(int)StandardCharCode.hyphen] = "-"; - table[(int)StandardCharCode.period] = "."; - table[(int)StandardCharCode.slash] = "/"; - table[(int)StandardCharCode.zero] = "0"; - table[(int)StandardCharCode.one] = "1"; - table[(int)StandardCharCode.two] = "2"; - table[(int)StandardCharCode.three] = "3"; - table[(int)StandardCharCode.four] = "4"; - table[(int)StandardCharCode.five] = "5"; - table[(int)StandardCharCode.six] = "6"; - table[(int)StandardCharCode.seven] = "7"; - table[(int)StandardCharCode.eight] = "8"; - table[(int)StandardCharCode.nine] = "9"; - table[(int)StandardCharCode.colon] = ":"; - table[(int)StandardCharCode.semicolon] = ";"; - table[(int)StandardCharCode.less] = "<"; - table[(int)StandardCharCode.equal] = "="; - table[(int)StandardCharCode.greater] = ">"; - table[(int)StandardCharCode.question] = "?"; - table[(int)StandardCharCode.at] = "@"; - table[(int)StandardCharCode.A] = "A"; - table[(int)StandardCharCode.B] = "B"; - table[(int)StandardCharCode.C] = "C"; - table[(int)StandardCharCode.D] = "D"; - table[(int)StandardCharCode.E] = "E"; - table[(int)StandardCharCode.F] = "F"; - table[(int)StandardCharCode.G] = "G"; - table[(int)StandardCharCode.H] = "H"; - table[(int)StandardCharCode.I] = "I"; - table[(int)StandardCharCode.J] = "J"; - table[(int)StandardCharCode.K] = "K"; - table[(int)StandardCharCode.L] = "L"; - table[(int)StandardCharCode.M] = "M"; - table[(int)StandardCharCode.N] = "N"; - table[(int)StandardCharCode.O] = "O"; - table[(int)StandardCharCode.P] = "P"; - table[(int)StandardCharCode.Q] = "Q"; - table[(int)StandardCharCode.R] = "R"; - table[(int)StandardCharCode.S] = "S"; - table[(int)StandardCharCode.T] = "T"; - table[(int)StandardCharCode.U] = "U"; - table[(int)StandardCharCode.V] = "V"; - table[(int)StandardCharCode.W] = "W"; - table[(int)StandardCharCode.X] = "X"; - table[(int)StandardCharCode.Y] = "Y"; - table[(int)StandardCharCode.Z] = "Z"; - table[(int)StandardCharCode.bracketleft] = "["; - table[(int)StandardCharCode.backslash] = "\\"; - table[(int)StandardCharCode.bracketright] = "]"; - table[(int)StandardCharCode.asciicircum] = "^"; - table[(int)StandardCharCode.underscore] = "_"; - table[(int)StandardCharCode.quoteleft] = "`"; - table[(int)StandardCharCode.a] = "a"; - table[(int)StandardCharCode.b] = "b"; - table[(int)StandardCharCode.c] = "c"; - table[(int)StandardCharCode.d] = "d"; - table[(int)StandardCharCode.e] = "e"; - table[(int)StandardCharCode.f] = "f"; - table[(int)StandardCharCode.g] = "g"; - table[(int)StandardCharCode.h] = "h"; - table[(int)StandardCharCode.i] = "i"; - table[(int)StandardCharCode.j] = "j"; - table[(int)StandardCharCode.k] = "k"; - table[(int)StandardCharCode.l] = "l"; - table[(int)StandardCharCode.m] = "m"; - table[(int)StandardCharCode.n] = "n"; - table[(int)StandardCharCode.o] = "o"; - table[(int)StandardCharCode.p] = "p"; - table[(int)StandardCharCode.q] = "q"; - table[(int)StandardCharCode.r] = "r"; - table[(int)StandardCharCode.s] = "s"; - table[(int)StandardCharCode.t] = "t"; - table[(int)StandardCharCode.u] = "u"; - table[(int)StandardCharCode.v] = "v"; - table[(int)StandardCharCode.w] = "w"; - table[(int)StandardCharCode.x] = "x"; - table[(int)StandardCharCode.y] = "y"; - table[(int)StandardCharCode.z] = "z"; - table[(int)StandardCharCode.braceleft] = "{"; - table[(int)StandardCharCode.bar] = "|"; - table[(int)StandardCharCode.braceright] = "}"; - table[(int)StandardCharCode.asciitilde] = "~"; - table[(int)StandardCharCode.AE] = "AE"; - table[(int)StandardCharCode.OE] = "OE"; - table[(int)StandardCharCode.acute] = "'"; - table[(int)StandardCharCode.ae] = "ae"; - table[(int)StandardCharCode.angleleft] = "<"; - table[(int)StandardCharCode.angleright] = ">"; - table[(int)StandardCharCode.arrowboth] = "<->"; - table[(int)StandardCharCode.arrowdblboth] = "<=>"; - table[(int)StandardCharCode.arrowdblleft] = "<="; - table[(int)StandardCharCode.arrowdblright] = "=>"; - table[(int)StandardCharCode.arrowleft] = "<-"; - table[(int)StandardCharCode.arrowright] = "->"; - table[(int)StandardCharCode.bullet] = "o"; - table[(int)StandardCharCode.cent] = "cent"; - table[(int)StandardCharCode.circumflex] = "^"; - table[(int)StandardCharCode.copyright] = "(c)"; - table[(int)StandardCharCode.copyrightsans] = "(c)"; - table[(int)StandardCharCode.degree] = "deg."; - table[(int)StandardCharCode.divide] = "/"; - table[(int)StandardCharCode.dotlessi] = "i"; - table[(int)StandardCharCode.ellipsis] = "..."; - table[(int)StandardCharCode.emdash] = "--"; - table[(int)StandardCharCode.endash] = "-"; - table[(int)StandardCharCode.fi] = "fi"; - table[(int)StandardCharCode.fl] = "fl"; - table[(int)StandardCharCode.fraction] = "/"; - table[(int)StandardCharCode.germandbls] = "ss"; - table[(int)StandardCharCode.grave] = "`"; - table[(int)StandardCharCode.greaterequal] = ">="; - table[(int)StandardCharCode.guillemotleft] = "<<"; - table[(int)StandardCharCode.guillemotright] = ">>"; - table[(int)StandardCharCode.guilsinglleft] = "<"; - table[(int)StandardCharCode.guilsinglright] = ">"; - table[(int)StandardCharCode.lessequal] = "<="; - table[(int)StandardCharCode.logicalnot] = "~"; - table[(int)StandardCharCode.mathasterisk] = "*"; - table[(int)StandardCharCode.mathequal] = "="; - table[(int)StandardCharCode.mathminus] = "-"; - table[(int)StandardCharCode.mathnumbersign] = "#"; - table[(int)StandardCharCode.mathplus] = "+"; - table[(int)StandardCharCode.mathtilde] = "~"; - table[(int)StandardCharCode.minus] = "-"; - table[(int)StandardCharCode.mu] = "u"; - table[(int)StandardCharCode.multiply] = "x"; - table[(int)StandardCharCode.nobrkhyphen] = "-"; - table[(int)StandardCharCode.nobrkspace] = ""; - table[(int)StandardCharCode.notequal] = "!="; - table[(int)StandardCharCode.oe] = "oe"; - table[(int)StandardCharCode.onehalf] = "1/2"; - table[(int)StandardCharCode.onequarter] = "1/4"; - table[(int)StandardCharCode.periodcentered] = "."; - table[(int)StandardCharCode.plusminus] = "+/-"; - table[(int)StandardCharCode.quotedblbase] = ",,"; - table[(int)StandardCharCode.quotedblleft] = "\""; - table[(int)StandardCharCode.quotedblright] = "\""; - table[(int)StandardCharCode.quotesinglbase] = ","; - table[(int)StandardCharCode.registered] = "reg."; - table[(int)StandardCharCode.registersans] = "reg."; - table[(int)StandardCharCode.threequarters] = "3/4"; - table[(int)StandardCharCode.tilde] = "~"; - table[(int)StandardCharCode.trademark] = "(TM)"; - table[(int)StandardCharCode.trademarksans] = "(TM)"; - - table[(int)StandardCharCode.aacute] = "\xE0"; - table[(int)StandardCharCode.questiondown] = "\xBF"; - - table[(int)StandardCharCode.udieresis] = "\xFC"; - table[(int)StandardCharCode.Udieresis] = "\xDC"; - table[(int)StandardCharCode.odieresis] = "\xF6"; - table[(int)StandardCharCode.Odieresis] = "\xD6"; - */ - - table [(int) StandardCharCode.formula] = "\x6"; - table [(int) StandardCharCode.nobrkhyphen] = "\x1e"; - table [(int) StandardCharCode.opthyphen] = "\x1f"; - table [(int) StandardCharCode.space] = " "; - table [(int) StandardCharCode.exclam] = "!"; - table [(int) StandardCharCode.quotedbl] = "\""; - table [(int) StandardCharCode.numbersign] = "#"; - table [(int) StandardCharCode.dollar] = "$"; - table [(int) StandardCharCode.percent] = "%"; - table [(int) StandardCharCode.ampersand] = "&"; - table [(int) StandardCharCode.parenleft] = "("; - table [(int) StandardCharCode.parenright] = ")"; - table [(int) StandardCharCode.asterisk] = "*"; - table [(int) StandardCharCode.plus] = "+"; - table [(int) StandardCharCode.comma] = ","; - table [(int) StandardCharCode.hyphen] = "-"; - table [(int) StandardCharCode.period] = "."; - table [(int) StandardCharCode.slash] = "/"; - table [(int) StandardCharCode.zero] = "0"; - table [(int) StandardCharCode.one] = "1"; - table [(int) StandardCharCode.two] = "2"; - table [(int) StandardCharCode.three] = "3"; - table [(int) StandardCharCode.four] = "4"; - table [(int) StandardCharCode.five] = "5"; - table [(int) StandardCharCode.six] = "6"; - table [(int) StandardCharCode.seven] = "7"; - table [(int) StandardCharCode.eight] = "8"; - table [(int) StandardCharCode.nine] = "9"; - table [(int) StandardCharCode.colon] = ":"; - table [(int) StandardCharCode.semicolon] = ";"; - table [(int) StandardCharCode.less] = "<"; - table [(int) StandardCharCode.equal] = "="; - table [(int) StandardCharCode.greater] = ">"; - table [(int) StandardCharCode.question] = "?"; - table [(int) StandardCharCode.at] = "@"; - table [(int) StandardCharCode.A] = "A"; - table [(int) StandardCharCode.B] = "B"; - table [(int) StandardCharCode.C] = "C"; - table [(int) StandardCharCode.D] = "D"; - table [(int) StandardCharCode.E] = "E"; - table [(int) StandardCharCode.F] = "F"; - table [(int) StandardCharCode.G] = "G"; - table [(int) StandardCharCode.H] = "H"; - table [(int) StandardCharCode.I] = "I"; - table [(int) StandardCharCode.J] = "J"; - table [(int) StandardCharCode.K] = "K"; - table [(int) StandardCharCode.L] = "L"; - table [(int) StandardCharCode.M] = "M"; - table [(int) StandardCharCode.N] = "N"; - table [(int) StandardCharCode.O] = "O"; - table [(int) StandardCharCode.P] = "P"; - table [(int) StandardCharCode.Q] = "Q"; - table [(int) StandardCharCode.R] = "R"; - table [(int) StandardCharCode.S] = "S"; - table [(int) StandardCharCode.T] = "T"; - table [(int) StandardCharCode.U] = "U"; - table [(int) StandardCharCode.V] = "V"; - table [(int) StandardCharCode.W] = "W"; - table [(int) StandardCharCode.X] = "X"; - table [(int) StandardCharCode.Y] = "Y"; - table [(int) StandardCharCode.Z] = "Z"; - table [(int) StandardCharCode.bracketleft] = "["; - table [(int) StandardCharCode.backslash] = "\\"; - table [(int) StandardCharCode.bracketright] = "]"; - table [(int) StandardCharCode.asciicircum] = "^"; - table [(int) StandardCharCode.underscore] = "_"; - table [(int) StandardCharCode.quoteleft] = "`"; - table [(int) StandardCharCode.a] = "a"; - table [(int) StandardCharCode.b] = "b"; - table [(int) StandardCharCode.c] = "c"; - table [(int) StandardCharCode.d] = "d"; - table [(int) StandardCharCode.e] = "e"; - table [(int) StandardCharCode.f] = "f"; - table [(int) StandardCharCode.g] = "g"; - table [(int) StandardCharCode.h] = "h"; - table [(int) StandardCharCode.i] = "i"; - table [(int) StandardCharCode.j] = "j"; - table [(int) StandardCharCode.k] = "k"; - table [(int) StandardCharCode.l] = "l"; - table [(int) StandardCharCode.m] = "m"; - table [(int) StandardCharCode.n] = "n"; - table [(int) StandardCharCode.o] = "o"; - table [(int) StandardCharCode.p] = "p"; - table [(int) StandardCharCode.q] = "q"; - table [(int) StandardCharCode.r] = "r"; - table [(int) StandardCharCode.s] = "s"; - table [(int) StandardCharCode.t] = "t"; - table [(int) StandardCharCode.u] = "u"; - table [(int) StandardCharCode.v] = "v"; - table [(int) StandardCharCode.w] = "w"; - table [(int) StandardCharCode.x] = "x"; - table [(int) StandardCharCode.y] = "y"; - table [(int) StandardCharCode.z] = "z"; - table [(int) StandardCharCode.braceleft] = "{"; - table [(int) StandardCharCode.bar] = "|"; - table [(int) StandardCharCode.braceright] = "}"; - table [(int) StandardCharCode.asciitilde] = "~"; - table [(int) StandardCharCode.nobrkspace] = "\xa0"; - table [(int) StandardCharCode.exclamdown] = "\xa1"; - table [(int) StandardCharCode.cent] = "\xa2"; - table [(int) StandardCharCode.sterling] = "\xa3"; - table [(int) StandardCharCode.currency] = "\xa4"; - table [(int) StandardCharCode.yen] = "\xa5"; - table [(int) StandardCharCode.brokenbar] = "\xa6"; - table [(int) StandardCharCode.section] = "\xa7"; - table [(int) StandardCharCode.dieresis] = "\xa8"; - table [(int) StandardCharCode.copyright] = "\xa9"; - table [(int) StandardCharCode.ordfeminine] = "\xaa"; - table [(int) StandardCharCode.guillemotleft] = "\xab"; - table [(int) StandardCharCode.logicalnot] = "\xac"; - table [(int) StandardCharCode.opthyphen] = "\xad"; - table [(int) StandardCharCode.registered] = "\xae"; - table [(int) StandardCharCode.macron] = "\xaf"; - table [(int) StandardCharCode.degree] = "\xb0"; - table [(int) StandardCharCode.plusminus] = "\xb1"; - table [(int) StandardCharCode.twosuperior] = "\xb2"; - table [(int) StandardCharCode.threesuperior] = "\xb3"; - table [(int) StandardCharCode.acute] = "\xb4"; - table [(int) StandardCharCode.mu] = "\xb5"; - table [(int) StandardCharCode.paragraph] = "\xb6"; - table [(int) StandardCharCode.periodcentered] = "\xb7"; - table [(int) StandardCharCode.cedilla] = "\xb8"; - table [(int) StandardCharCode.onesuperior] = "\xb9"; - table [(int) StandardCharCode.ordmasculine] = "\xba"; - table [(int) StandardCharCode.guillemotright] = "\xbb"; - table [(int) StandardCharCode.onequarter] = "\xbc"; - table [(int) StandardCharCode.onehalf] = "\xbd"; - table [(int) StandardCharCode.threequarters] = "\xbe"; - table [(int) StandardCharCode.questiondown] = "\xbf"; - table [(int) StandardCharCode.Agrave] = "\xc0"; - table [(int) StandardCharCode.Aacute] = "\xc1"; - table [(int) StandardCharCode.Acircumflex] = "\xc2"; - table [(int) StandardCharCode.Atilde] = "\xc3"; - table [(int) StandardCharCode.Adieresis] = "\xc4"; - table [(int) StandardCharCode.Aring] = "\xc5"; - table [(int) StandardCharCode.AE] = "\xc6"; - table [(int) StandardCharCode.Ccedilla] = "\xc7"; - table [(int) StandardCharCode.Egrave] = "\xc8"; - table [(int) StandardCharCode.Eacute] = "\xc9"; - table [(int) StandardCharCode.Ecircumflex] = "\xca"; - table [(int) StandardCharCode.Edieresis] = "\xcb"; - table [(int) StandardCharCode.Igrave] = "\xcc"; - table [(int) StandardCharCode.Iacute] = "\xcd"; - table [(int) StandardCharCode.Icircumflex] = "\xce"; - table [(int) StandardCharCode.Idieresis] = "\xcf"; - table [(int) StandardCharCode.Eth] = "\xd0"; - table [(int) StandardCharCode.Ntilde] = "\xd1"; - table [(int) StandardCharCode.Ograve] = "\xd2"; - table [(int) StandardCharCode.Oacute] = "\xd3"; - table [(int) StandardCharCode.Ocircumflex] = "\xd4"; - table [(int) StandardCharCode.Otilde] = "\xd5"; - table [(int) StandardCharCode.Odieresis] = "\xd6"; - table [(int) StandardCharCode.multiply] = "\xd7"; - table [(int) StandardCharCode.Oslash] = "\xd8"; - table [(int) StandardCharCode.Ugrave] = "\xd9"; - table [(int) StandardCharCode.Uacute] = "\xda"; - table [(int) StandardCharCode.Ucircumflex] = "\xdb"; - table [(int) StandardCharCode.Udieresis] = "\xdc"; - table [(int) StandardCharCode.Yacute] = "\xdd"; - table [(int) StandardCharCode.Thorn] = "\xde"; - table [(int) StandardCharCode.germandbls] = "\xdf"; - table [(int) StandardCharCode.agrave] = "\xe0"; - table [(int) StandardCharCode.aacute] = "\xe1"; - table [(int) StandardCharCode.acircumflex] = "\xe2"; - table [(int) StandardCharCode.atilde] = "\xe3"; - table [(int) StandardCharCode.adieresis] = "\xe4"; - table [(int) StandardCharCode.aring] = "\xe5"; - table [(int) StandardCharCode.ae] = "\xe6"; - table [(int) StandardCharCode.ccedilla] = "\xe7"; - table [(int) StandardCharCode.egrave] = "\xe8"; - table [(int) StandardCharCode.eacute] = "\xe9"; - table [(int) StandardCharCode.ecircumflex] = "\xea"; - table [(int) StandardCharCode.edieresis] = "\xeb"; - table [(int) StandardCharCode.igrave] = "\xec"; - table [(int) StandardCharCode.iacute] = "\xed"; - table [(int) StandardCharCode.icircumflex] = "\xee"; - table [(int) StandardCharCode.idieresis] = "\xef"; - table [(int) StandardCharCode.eth] = "\xf0"; - table [(int) StandardCharCode.ntilde] = "\xf1"; - table [(int) StandardCharCode.ograve] = "\xf2"; - table [(int) StandardCharCode.oacute] = "\xf3"; - table [(int) StandardCharCode.ocircumflex] = "\xf4"; - table [(int) StandardCharCode.otilde] = "\xf5"; - table [(int) StandardCharCode.odieresis] = "\xf6"; - table [(int) StandardCharCode.divide] = "\xf7"; - table [(int) StandardCharCode.oslash] = "\xf8"; - table [(int) StandardCharCode.ugrave] = "\xf9"; - table [(int) StandardCharCode.uacute] = "\xfa"; - table [(int) StandardCharCode.ucircumflex] = "\xfb"; - table [(int) StandardCharCode.udieresis] = "\xfc"; - table [(int) StandardCharCode.yacute] = "\xfd"; - table [(int) StandardCharCode.thorn] = "\xfe"; - table [(int) StandardCharCode.ydieresis] = "\xff"; - - } - #endregion // Public Static Methods - } -} diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.csproj b/mcs/class/System.Windows.Forms/System.Windows.Forms.csproj index 0e448e5822a..f09cdc569ba 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms.csproj +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.csproj @@ -103,6 +103,7 @@ <Compile Include="System.Windows.Forms.RTF\Charcode.cs" /> <Compile Include="System.Windows.Forms.RTF\Charset.cs" /> <Compile Include="System.Windows.Forms.RTF\CharsetFlags.cs" /> + <Compile Include="System.Windows.Forms.RTF\CharsetToCodepage.cs" /> <Compile Include="System.Windows.Forms.RTF\CharsetType.cs" /> <Compile Include="System.Windows.Forms.RTF\ClassDelegate.cs" /> <Compile Include="System.Windows.Forms.RTF\Color.cs" /> diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.dll.sources b/mcs/class/System.Windows.Forms/System.Windows.Forms.dll.sources index cd33ee3959c..235dd61bed4 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms.dll.sources +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.dll.sources @@ -29,9 +29,7 @@ System.Windows.Forms.Design/WindowsFormsComponentEditor.cs System.Windows.Forms.Internal/Accessor.cs System.Windows.Forms.Internal/DebugHelper.cs System.Windows.Forms.PropertyGridInternal/PropertiesTab.cs -System.Windows.Forms.RTF/Charcode.cs -System.Windows.Forms.RTF/Charset.cs -System.Windows.Forms.RTF/CharsetFlags.cs +System.Windows.Forms.RTF/CharsetToCodepage.cs System.Windows.Forms.RTF/CharsetType.cs System.Windows.Forms.RTF/ClassDelegate.cs System.Windows.Forms.RTF/Color.cs @@ -44,12 +42,9 @@ System.Windows.Forms.RTF/Minor.cs System.Windows.Forms.RTF/Picture.cs System.Windows.Forms.RTF/RTF.cs System.Windows.Forms.RTF/RTFException.cs -System.Windows.Forms.RTF/StandardCharCode.cs -System.Windows.Forms.RTF/StandardCharName.cs System.Windows.Forms.RTF/Style.cs System.Windows.Forms.RTF/StyleElement.cs System.Windows.Forms.RTF/StyleType.cs -System.Windows.Forms.RTF/TextMap.cs System.Windows.Forms.RTF/TokenClass.cs System.Windows.Forms.Theming/Default/LabelPainter.cs System.Windows.Forms.Theming/Default/LinkLabelPainter.cs diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBox.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBox.cs index 1245cdd47d6..ec1221d0d99 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBox.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBox.cs @@ -60,7 +60,6 @@ namespace System.Windows.Forms { private bool fire_contents_resized; private Size existing_contents_size; - private RTF.TextMap rtf_text_map; private int rtf_skip_count; private int rtf_cursor_x; private int rtf_cursor_y; @@ -2088,6 +2087,8 @@ namespace System.Windows.Forms { } font = new Font (rtf_style.rtf_rtffont.Name, rtf_style.rtf_rtffont_size, rtf_style.rtf_rtfstyle); + if (font.Name != rtf_style.rtf_rtffont.Name && !string.IsNullOrEmpty(rtf_style.rtf_rtffont.AltName)) + font = new Font (rtf_style.rtf_rtffont.AltName, rtf_style.rtf_rtffont_size, rtf_style.rtf_rtfstyle); hanging_indent = -rtf_style.rtf_par_first_line_indent; left_indent = rtf_style.rtf_par_line_left_indent - hanging_indent; @@ -2204,9 +2205,6 @@ namespace System.Windows.Forms { rtf_chars = 0; rtf.DefaultFont(this.Font.Name); - rtf_text_map = new RTF.TextMap(); - RTF.TextMap.SetupStandardTable(rtf_text_map.Table); - document.SuspendRecalc (); try { |