forked from jasder/antlr
add ArialNarrow, update to 255 max char
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9190]
This commit is contained in:
parent
490cec9af6
commit
fc85072851
|
@ -31,7 +31,7 @@ package org.antlr.v4.runtime.tree.gui;
|
||||||
|
|
||||||
public class Arial extends BasicFontMetrics {
|
public class Arial extends BasicFontMetrics {
|
||||||
{
|
{
|
||||||
maxCharHeight = 781;
|
maxCharHeight = 896;
|
||||||
widths[32] = 277; // space
|
widths[32] = 277; // space
|
||||||
widths[33] = 277; // exclam
|
widths[33] = 277; // exclam
|
||||||
widths[34] = 354; // quotedbl
|
widths[34] = 354; // quotedbl
|
||||||
|
@ -127,5 +127,101 @@ public class Arial extends BasicFontMetrics {
|
||||||
widths[124] = 259; // bar
|
widths[124] = 259; // bar
|
||||||
widths[125] = 333; // braceright
|
widths[125] = 333; // braceright
|
||||||
widths[126] = 583; // asciitilde
|
widths[126] = 583; // asciitilde
|
||||||
|
widths[160] = 277; // nbspace
|
||||||
|
widths[161] = 333; // exclamdown
|
||||||
|
widths[162] = 556; // cent
|
||||||
|
widths[163] = 556; // sterling
|
||||||
|
widths[164] = 556; // currency
|
||||||
|
widths[165] = 556; // yen
|
||||||
|
widths[166] = 259; // brokenbar
|
||||||
|
widths[167] = 556; // section
|
||||||
|
widths[168] = 333; // dieresis
|
||||||
|
widths[169] = 736; // copyright
|
||||||
|
widths[170] = 370; // ordfeminine
|
||||||
|
widths[171] = 556; // guillemotleft
|
||||||
|
widths[172] = 583; // logicalnot
|
||||||
|
widths[173] = 333; // sfthyphen
|
||||||
|
widths[174] = 736; // registered
|
||||||
|
widths[175] = 552; // overscore
|
||||||
|
widths[176] = 399; // degree
|
||||||
|
widths[177] = 548; // plusminus
|
||||||
|
widths[178] = 333; // twosuperior
|
||||||
|
widths[179] = 333; // threesuperior
|
||||||
|
widths[180] = 333; // acute
|
||||||
|
widths[181] = 576; // mu1
|
||||||
|
widths[182] = 537; // paragraph
|
||||||
|
widths[183] = 333; // middot
|
||||||
|
widths[184] = 333; // cedilla
|
||||||
|
widths[185] = 333; // onesuperior
|
||||||
|
widths[186] = 365; // ordmasculine
|
||||||
|
widths[187] = 556; // guillemotright
|
||||||
|
widths[188] = 833; // onequarter
|
||||||
|
widths[189] = 833; // onehalf
|
||||||
|
widths[190] = 833; // threequarters
|
||||||
|
widths[191] = 610; // questiondown
|
||||||
|
widths[192] = 666; // Agrave
|
||||||
|
widths[193] = 666; // Aacute
|
||||||
|
widths[194] = 666; // Acircumflex
|
||||||
|
widths[195] = 666; // Atilde
|
||||||
|
widths[196] = 666; // Adieresis
|
||||||
|
widths[197] = 666; // Aring
|
||||||
|
widths[198] = 1000; // AE
|
||||||
|
widths[199] = 722; // Ccedilla
|
||||||
|
widths[200] = 666; // Egrave
|
||||||
|
widths[201] = 666; // Eacute
|
||||||
|
widths[202] = 666; // Ecircumflex
|
||||||
|
widths[203] = 666; // Edieresis
|
||||||
|
widths[204] = 277; // Igrave
|
||||||
|
widths[205] = 277; // Iacute
|
||||||
|
widths[206] = 277; // Icircumflex
|
||||||
|
widths[207] = 277; // Idieresis
|
||||||
|
widths[208] = 722; // Eth
|
||||||
|
widths[209] = 722; // Ntilde
|
||||||
|
widths[210] = 777; // Ograve
|
||||||
|
widths[211] = 777; // Oacute
|
||||||
|
widths[212] = 777; // Ocircumflex
|
||||||
|
widths[213] = 777; // Otilde
|
||||||
|
widths[214] = 777; // Odieresis
|
||||||
|
widths[215] = 583; // multiply
|
||||||
|
widths[216] = 777; // Oslash
|
||||||
|
widths[217] = 722; // Ugrave
|
||||||
|
widths[218] = 722; // Uacute
|
||||||
|
widths[219] = 722; // Ucircumflex
|
||||||
|
widths[220] = 722; // Udieresis
|
||||||
|
widths[221] = 666; // Yacute
|
||||||
|
widths[222] = 666; // Thorn
|
||||||
|
widths[223] = 610; // germandbls
|
||||||
|
widths[224] = 556; // agrave
|
||||||
|
widths[225] = 556; // aacute
|
||||||
|
widths[226] = 556; // acircumflex
|
||||||
|
widths[227] = 556; // atilde
|
||||||
|
widths[228] = 556; // adieresis
|
||||||
|
widths[229] = 556; // aring
|
||||||
|
widths[230] = 889; // ae
|
||||||
|
widths[231] = 500; // ccedilla
|
||||||
|
widths[232] = 556; // egrave
|
||||||
|
widths[233] = 556; // eacute
|
||||||
|
widths[234] = 556; // ecircumflex
|
||||||
|
widths[235] = 556; // edieresis
|
||||||
|
widths[236] = 277; // igrave
|
||||||
|
widths[237] = 277; // iacute
|
||||||
|
widths[238] = 277; // icircumflex
|
||||||
|
widths[239] = 277; // idieresis
|
||||||
|
widths[240] = 556; // eth
|
||||||
|
widths[241] = 556; // ntilde
|
||||||
|
widths[242] = 556; // ograve
|
||||||
|
widths[243] = 556; // oacute
|
||||||
|
widths[244] = 556; // ocircumflex
|
||||||
|
widths[245] = 556; // otilde
|
||||||
|
widths[246] = 556; // odieresis
|
||||||
|
widths[247] = 548; // divide
|
||||||
|
widths[248] = 610; // oslash
|
||||||
|
widths[249] = 556; // ugrave
|
||||||
|
widths[250] = 556; // uacute
|
||||||
|
widths[251] = 556; // ucircumflex
|
||||||
|
widths[252] = 556; // udieresis
|
||||||
|
widths[253] = 500; // yacute
|
||||||
|
widths[254] = 556; // thorn
|
||||||
|
widths[255] = 500; // ydieresis
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -31,7 +31,7 @@ package org.antlr.v4.runtime.tree.gui;
|
||||||
|
|
||||||
public class ArialBlack extends BasicFontMetrics {
|
public class ArialBlack extends BasicFontMetrics {
|
||||||
{
|
{
|
||||||
maxCharHeight = 770;
|
maxCharHeight = 905;
|
||||||
widths[32] = 333; // space
|
widths[32] = 333; // space
|
||||||
widths[33] = 333; // exclam
|
widths[33] = 333; // exclam
|
||||||
widths[34] = 500; // quotedbl
|
widths[34] = 500; // quotedbl
|
||||||
|
@ -127,5 +127,101 @@ public class ArialBlack extends BasicFontMetrics {
|
||||||
widths[124] = 277; // bar
|
widths[124] = 277; // bar
|
||||||
widths[125] = 389; // braceright
|
widths[125] = 389; // braceright
|
||||||
widths[126] = 660; // asciitilde
|
widths[126] = 660; // asciitilde
|
||||||
|
widths[160] = 333; // nbspace
|
||||||
|
widths[161] = 333; // exclamdown
|
||||||
|
widths[162] = 666; // cent
|
||||||
|
widths[163] = 666; // sterling
|
||||||
|
widths[164] = 660; // currency
|
||||||
|
widths[165] = 666; // yen
|
||||||
|
widths[166] = 277; // brokenbar
|
||||||
|
widths[167] = 666; // section
|
||||||
|
widths[168] = 333; // dieresis
|
||||||
|
widths[169] = 799; // copyright
|
||||||
|
widths[170] = 399; // ordfeminine
|
||||||
|
widths[171] = 666; // guillemotleft
|
||||||
|
widths[172] = 660; // logicalnot
|
||||||
|
widths[173] = 333; // sfthyphen
|
||||||
|
widths[174] = 799; // registered
|
||||||
|
widths[175] = 500; // overscore
|
||||||
|
widths[176] = 399; // degree
|
||||||
|
widths[177] = 660; // plusminus
|
||||||
|
widths[178] = 399; // twosuperior
|
||||||
|
widths[179] = 399; // threesuperior
|
||||||
|
widths[180] = 333; // acute
|
||||||
|
widths[181] = 666; // mu1
|
||||||
|
widths[182] = 850; // paragraph
|
||||||
|
widths[183] = 333; // middot
|
||||||
|
widths[184] = 333; // cedilla
|
||||||
|
widths[185] = 399; // onesuperior
|
||||||
|
widths[186] = 399; // ordmasculine
|
||||||
|
widths[187] = 666; // guillemotright
|
||||||
|
widths[188] = 1000; // onequarter
|
||||||
|
widths[189] = 1000; // onehalf
|
||||||
|
widths[190] = 1000; // threequarters
|
||||||
|
widths[191] = 610; // questiondown
|
||||||
|
widths[192] = 777; // Agrave
|
||||||
|
widths[193] = 777; // Aacute
|
||||||
|
widths[194] = 777; // Acircumflex
|
||||||
|
widths[195] = 777; // Atilde
|
||||||
|
widths[196] = 777; // Adieresis
|
||||||
|
widths[197] = 777; // Aring
|
||||||
|
widths[198] = 1000; // AE
|
||||||
|
widths[199] = 777; // Ccedilla
|
||||||
|
widths[200] = 722; // Egrave
|
||||||
|
widths[201] = 722; // Eacute
|
||||||
|
widths[202] = 722; // Ecircumflex
|
||||||
|
widths[203] = 722; // Edieresis
|
||||||
|
widths[204] = 389; // Igrave
|
||||||
|
widths[205] = 389; // Iacute
|
||||||
|
widths[206] = 389; // Icircumflex
|
||||||
|
widths[207] = 389; // Idieresis
|
||||||
|
widths[208] = 777; // Eth
|
||||||
|
widths[209] = 833; // Ntilde
|
||||||
|
widths[210] = 833; // Ograve
|
||||||
|
widths[211] = 833; // Oacute
|
||||||
|
widths[212] = 833; // Ocircumflex
|
||||||
|
widths[213] = 833; // Otilde
|
||||||
|
widths[214] = 833; // Odieresis
|
||||||
|
widths[215] = 660; // multiply
|
||||||
|
widths[216] = 833; // Oslash
|
||||||
|
widths[217] = 833; // Ugrave
|
||||||
|
widths[218] = 833; // Uacute
|
||||||
|
widths[219] = 833; // Ucircumflex
|
||||||
|
widths[220] = 833; // Udieresis
|
||||||
|
widths[221] = 777; // Yacute
|
||||||
|
widths[222] = 722; // Thorn
|
||||||
|
widths[223] = 666; // germandbls
|
||||||
|
widths[224] = 666; // agrave
|
||||||
|
widths[225] = 666; // aacute
|
||||||
|
widths[226] = 666; // acircumflex
|
||||||
|
widths[227] = 666; // atilde
|
||||||
|
widths[228] = 666; // adieresis
|
||||||
|
widths[229] = 666; // aring
|
||||||
|
widths[230] = 1000; // ae
|
||||||
|
widths[231] = 666; // ccedilla
|
||||||
|
widths[232] = 666; // egrave
|
||||||
|
widths[233] = 666; // eacute
|
||||||
|
widths[234] = 666; // ecircumflex
|
||||||
|
widths[235] = 666; // edieresis
|
||||||
|
widths[236] = 333; // igrave
|
||||||
|
widths[237] = 333; // iacute
|
||||||
|
widths[238] = 333; // icircumflex
|
||||||
|
widths[239] = 333; // idieresis
|
||||||
|
widths[240] = 666; // eth
|
||||||
|
widths[241] = 666; // ntilde
|
||||||
|
widths[242] = 666; // ograve
|
||||||
|
widths[243] = 666; // oacute
|
||||||
|
widths[244] = 666; // ocircumflex
|
||||||
|
widths[245] = 666; // otilde
|
||||||
|
widths[246] = 666; // odieresis
|
||||||
|
widths[247] = 660; // divide
|
||||||
|
widths[248] = 666; // oslash
|
||||||
|
widths[249] = 666; // ugrave
|
||||||
|
widths[250] = 666; // uacute
|
||||||
|
widths[251] = 666; // ucircumflex
|
||||||
|
widths[252] = 666; // udieresis
|
||||||
|
widths[253] = 610; // yacute
|
||||||
|
widths[254] = 666; // thorn
|
||||||
|
widths[255] = 610; // ydieresis
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,227 @@
|
||||||
|
/*
|
||||||
|
[The "BSD license"]
|
||||||
|
Copyright (c) 2011 Terence Parr
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
3. The name of the author may not be used to endorse or promote products
|
||||||
|
derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||||
|
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.antlr.v4.runtime.tree.gui;
|
||||||
|
|
||||||
|
public class ArialNarrow extends BasicFontMetrics {
|
||||||
|
{
|
||||||
|
maxCharHeight = 921;
|
||||||
|
widths[32] = 228; // space
|
||||||
|
widths[33] = 228; // exclam
|
||||||
|
widths[34] = 291; // quotedbl
|
||||||
|
widths[35] = 456; // numbersign
|
||||||
|
widths[36] = 456; // dollar
|
||||||
|
widths[37] = 729; // percent
|
||||||
|
widths[38] = 546; // ampersand
|
||||||
|
widths[39] = 157; // quotesingle
|
||||||
|
widths[40] = 272; // parenleft
|
||||||
|
widths[41] = 272; // parenright
|
||||||
|
widths[42] = 318; // asterisk
|
||||||
|
widths[43] = 479; // plus
|
||||||
|
widths[44] = 228; // comma
|
||||||
|
widths[45] = 272; // hyphen
|
||||||
|
widths[46] = 228; // period
|
||||||
|
widths[47] = 228; // slash
|
||||||
|
widths[48] = 456; // zero
|
||||||
|
widths[49] = 456; // one
|
||||||
|
widths[50] = 456; // two
|
||||||
|
widths[51] = 456; // three
|
||||||
|
widths[52] = 456; // four
|
||||||
|
widths[53] = 456; // five
|
||||||
|
widths[54] = 456; // six
|
||||||
|
widths[55] = 456; // seven
|
||||||
|
widths[56] = 456; // eight
|
||||||
|
widths[57] = 456; // nine
|
||||||
|
widths[58] = 228; // colon
|
||||||
|
widths[59] = 228; // semicolon
|
||||||
|
widths[60] = 479; // less
|
||||||
|
widths[61] = 479; // equal
|
||||||
|
widths[62] = 479; // greater
|
||||||
|
widths[63] = 456; // question
|
||||||
|
widths[64] = 832; // at
|
||||||
|
widths[65] = 546; // A
|
||||||
|
widths[66] = 546; // B
|
||||||
|
widths[67] = 591; // C
|
||||||
|
widths[68] = 591; // D
|
||||||
|
widths[69] = 546; // E
|
||||||
|
widths[70] = 500; // F
|
||||||
|
widths[71] = 638; // G
|
||||||
|
widths[72] = 591; // H
|
||||||
|
widths[73] = 228; // I
|
||||||
|
widths[74] = 410; // J
|
||||||
|
widths[75] = 546; // K
|
||||||
|
widths[76] = 456; // L
|
||||||
|
widths[77] = 683; // M
|
||||||
|
widths[78] = 591; // N
|
||||||
|
widths[79] = 638; // O
|
||||||
|
widths[80] = 546; // P
|
||||||
|
widths[81] = 638; // Q
|
||||||
|
widths[82] = 591; // R
|
||||||
|
widths[83] = 546; // S
|
||||||
|
widths[84] = 500; // T
|
||||||
|
widths[85] = 591; // U
|
||||||
|
widths[86] = 546; // V
|
||||||
|
widths[87] = 773; // W
|
||||||
|
widths[88] = 546; // X
|
||||||
|
widths[89] = 546; // Y
|
||||||
|
widths[90] = 500; // Z
|
||||||
|
widths[91] = 228; // bracketleft
|
||||||
|
widths[92] = 228; // backslash
|
||||||
|
widths[93] = 228; // bracketright
|
||||||
|
widths[94] = 384; // asciicircum
|
||||||
|
widths[95] = 456; // underscore
|
||||||
|
widths[96] = 272; // grave
|
||||||
|
widths[97] = 456; // a
|
||||||
|
widths[98] = 456; // b
|
||||||
|
widths[99] = 410; // c
|
||||||
|
widths[100] = 456; // d
|
||||||
|
widths[101] = 456; // e
|
||||||
|
widths[102] = 228; // f
|
||||||
|
widths[103] = 456; // g
|
||||||
|
widths[104] = 456; // h
|
||||||
|
widths[105] = 182; // i
|
||||||
|
widths[106] = 182; // j
|
||||||
|
widths[107] = 410; // k
|
||||||
|
widths[108] = 182; // l
|
||||||
|
widths[109] = 683; // m
|
||||||
|
widths[110] = 456; // n
|
||||||
|
widths[111] = 456; // o
|
||||||
|
widths[112] = 456; // p
|
||||||
|
widths[113] = 456; // q
|
||||||
|
widths[114] = 272; // r
|
||||||
|
widths[115] = 410; // s
|
||||||
|
widths[116] = 228; // t
|
||||||
|
widths[117] = 456; // u
|
||||||
|
widths[118] = 410; // v
|
||||||
|
widths[119] = 591; // w
|
||||||
|
widths[120] = 410; // x
|
||||||
|
widths[121] = 410; // y
|
||||||
|
widths[122] = 410; // z
|
||||||
|
widths[123] = 273; // braceleft
|
||||||
|
widths[124] = 212; // bar
|
||||||
|
widths[125] = 273; // braceright
|
||||||
|
widths[126] = 479; // asciitilde
|
||||||
|
widths[160] = 228; // nbspace
|
||||||
|
widths[161] = 272; // exclamdown
|
||||||
|
widths[162] = 456; // cent
|
||||||
|
widths[163] = 456; // sterling
|
||||||
|
widths[164] = 456; // currency
|
||||||
|
widths[165] = 456; // yen
|
||||||
|
widths[166] = 212; // brokenbar
|
||||||
|
widths[167] = 456; // section
|
||||||
|
widths[168] = 272; // dieresis
|
||||||
|
widths[169] = 604; // copyright
|
||||||
|
widths[170] = 303; // ordfeminine
|
||||||
|
widths[171] = 456; // guillemotleft
|
||||||
|
widths[172] = 479; // logicalnot
|
||||||
|
widths[173] = 272; // sfthyphen
|
||||||
|
widths[174] = 604; // registered
|
||||||
|
widths[175] = 500; // overscore
|
||||||
|
widths[176] = 399; // degree
|
||||||
|
widths[177] = 548; // plusminus
|
||||||
|
widths[178] = 272; // twosuperior
|
||||||
|
widths[179] = 272; // threesuperior
|
||||||
|
widths[180] = 272; // acute
|
||||||
|
widths[181] = 576; // mu1
|
||||||
|
widths[182] = 439; // paragraph
|
||||||
|
widths[183] = 271; // middot
|
||||||
|
widths[184] = 272; // cedilla
|
||||||
|
widths[185] = 272; // onesuperior
|
||||||
|
widths[186] = 298; // ordmasculine
|
||||||
|
widths[187] = 456; // guillemotright
|
||||||
|
widths[188] = 684; // onequarter
|
||||||
|
widths[189] = 684; // onehalf
|
||||||
|
widths[190] = 684; // threequarters
|
||||||
|
widths[191] = 500; // questiondown
|
||||||
|
widths[192] = 546; // Agrave
|
||||||
|
widths[193] = 546; // Aacute
|
||||||
|
widths[194] = 546; // Acircumflex
|
||||||
|
widths[195] = 546; // Atilde
|
||||||
|
widths[196] = 546; // Adieresis
|
||||||
|
widths[197] = 546; // Aring
|
||||||
|
widths[198] = 819; // AE
|
||||||
|
widths[199] = 591; // Ccedilla
|
||||||
|
widths[200] = 546; // Egrave
|
||||||
|
widths[201] = 546; // Eacute
|
||||||
|
widths[202] = 546; // Ecircumflex
|
||||||
|
widths[203] = 546; // Edieresis
|
||||||
|
widths[204] = 228; // Igrave
|
||||||
|
widths[205] = 228; // Iacute
|
||||||
|
widths[206] = 228; // Icircumflex
|
||||||
|
widths[207] = 228; // Idieresis
|
||||||
|
widths[208] = 591; // Eth
|
||||||
|
widths[209] = 591; // Ntilde
|
||||||
|
widths[210] = 638; // Ograve
|
||||||
|
widths[211] = 638; // Oacute
|
||||||
|
widths[212] = 638; // Ocircumflex
|
||||||
|
widths[213] = 638; // Otilde
|
||||||
|
widths[214] = 638; // Odieresis
|
||||||
|
widths[215] = 479; // multiply
|
||||||
|
widths[216] = 638; // Oslash
|
||||||
|
widths[217] = 591; // Ugrave
|
||||||
|
widths[218] = 591; // Uacute
|
||||||
|
widths[219] = 591; // Ucircumflex
|
||||||
|
widths[220] = 591; // Udieresis
|
||||||
|
widths[221] = 546; // Yacute
|
||||||
|
widths[222] = 546; // Thorn
|
||||||
|
widths[223] = 500; // germandbls
|
||||||
|
widths[224] = 456; // agrave
|
||||||
|
widths[225] = 456; // aacute
|
||||||
|
widths[226] = 456; // acircumflex
|
||||||
|
widths[227] = 456; // atilde
|
||||||
|
widths[228] = 456; // adieresis
|
||||||
|
widths[229] = 456; // aring
|
||||||
|
widths[230] = 729; // ae
|
||||||
|
widths[231] = 410; // ccedilla
|
||||||
|
widths[232] = 456; // egrave
|
||||||
|
widths[233] = 456; // eacute
|
||||||
|
widths[234] = 456; // ecircumflex
|
||||||
|
widths[235] = 456; // edieresis
|
||||||
|
widths[236] = 228; // igrave
|
||||||
|
widths[237] = 228; // iacute
|
||||||
|
widths[238] = 228; // icircumflex
|
||||||
|
widths[239] = 228; // idieresis
|
||||||
|
widths[240] = 456; // eth
|
||||||
|
widths[241] = 456; // ntilde
|
||||||
|
widths[242] = 456; // ograve
|
||||||
|
widths[243] = 456; // oacute
|
||||||
|
widths[244] = 456; // ocircumflex
|
||||||
|
widths[245] = 456; // otilde
|
||||||
|
widths[246] = 456; // odieresis
|
||||||
|
widths[247] = 548; // divide
|
||||||
|
widths[248] = 500; // oslash
|
||||||
|
widths[249] = 456; // ugrave
|
||||||
|
widths[250] = 456; // uacute
|
||||||
|
widths[251] = 456; // ucircumflex
|
||||||
|
widths[252] = 456; // udieresis
|
||||||
|
widths[253] = 410; // yacute
|
||||||
|
widths[254] = 456; // thorn
|
||||||
|
widths[255] = 410; // ydieresis
|
||||||
|
}
|
||||||
|
}
|
|
@ -49,10 +49,9 @@ package org.antlr.v4.runtime.tree.gui;
|
||||||
#
|
#
|
||||||
lines = open("metrics").read().split('\n')
|
lines = open("metrics").read().split('\n')
|
||||||
print "public class FontName {"
|
print "public class FontName {"
|
||||||
print " public static int[] widths = new int[128];"
|
print " {"
|
||||||
print " static {"
|
|
||||||
maxh = 0;
|
maxh = 0;
|
||||||
for line in lines:
|
for line in lines[4:]: # skip header 0..3
|
||||||
all = line.split(' ')
|
all = line.split(' ')
|
||||||
words = [x for x in all if len(x)>0]
|
words = [x for x in all if len(x)>0]
|
||||||
ascii = int(words[1], 16)
|
ascii = int(words[1], 16)
|
||||||
|
@ -61,15 +60,16 @@ package org.antlr.v4.runtime.tree.gui;
|
||||||
if ascii>=128: break
|
if ascii>=128: break
|
||||||
print " widths[%d] = %s; // %s" % (ascii, words[3], words[2])
|
print " widths[%d] = %s; // %s" % (ascii, words[3], words[2])
|
||||||
|
|
||||||
|
print " maxCharHeight = "+str(maxh)+";"
|
||||||
print " }"
|
print " }"
|
||||||
print " public static int MAX_CHAR_HEIGHT = "+str(maxh)+";"
|
|
||||||
print "}"
|
print "}"
|
||||||
|
|
||||||
Units are 1000th of an 'em'.
|
Units are 1000th of an 'em'.
|
||||||
*/
|
*/
|
||||||
public abstract class BasicFontMetrics {
|
public abstract class BasicFontMetrics {
|
||||||
|
public static final int MAX_CHAR = '\u00FF';
|
||||||
protected int maxCharHeight;
|
protected int maxCharHeight;
|
||||||
protected int[] widths = new int[128];
|
protected int[] widths = new int[MAX_CHAR+1];
|
||||||
|
|
||||||
public double getWidth(String s, int fontSize) {
|
public double getWidth(String s, int fontSize) {
|
||||||
double w = 0;
|
double w = 0;
|
||||||
|
@ -80,6 +80,7 @@ public abstract class BasicFontMetrics {
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getWidth(char c, int fontSize) {
|
public double getWidth(char c, int fontSize) {
|
||||||
|
if ( c > MAX_CHAR || widths[c]==0 ) return widths['m']/1000.0; // return width('m')
|
||||||
return widths[c]/1000.0 * fontSize;
|
return widths[c]/1000.0 * fontSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,6 @@ package org.antlr.v4.runtime.tree.gui;
|
||||||
public class CourierNew extends BasicFontMetrics {
|
public class CourierNew extends BasicFontMetrics {
|
||||||
{
|
{
|
||||||
maxCharHeight = 678;
|
maxCharHeight = 678;
|
||||||
for (int i=0; i<128; i++) widths[i] = 600;
|
for (int i=0; i<MAX_CHAR; i++) widths[i] = 600;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ package org.antlr.v4.runtime.tree.gui;
|
||||||
|
|
||||||
public class TimesNewRoman extends BasicFontMetrics {
|
public class TimesNewRoman extends BasicFontMetrics {
|
||||||
{
|
{
|
||||||
maxCharHeight = 717;
|
maxCharHeight = 877;
|
||||||
widths[32] = 250; // space
|
widths[32] = 250; // space
|
||||||
widths[33] = 333; // exclam
|
widths[33] = 333; // exclam
|
||||||
widths[34] = 408; // quotedbl
|
widths[34] = 408; // quotedbl
|
||||||
|
@ -127,5 +127,101 @@ public class TimesNewRoman extends BasicFontMetrics {
|
||||||
widths[124] = 200; // bar
|
widths[124] = 200; // bar
|
||||||
widths[125] = 479; // braceright
|
widths[125] = 479; // braceright
|
||||||
widths[126] = 541; // asciitilde
|
widths[126] = 541; // asciitilde
|
||||||
|
widths[160] = 250; // nbspace
|
||||||
|
widths[161] = 333; // exclamdown
|
||||||
|
widths[162] = 500; // cent
|
||||||
|
widths[163] = 500; // sterling
|
||||||
|
widths[164] = 500; // currency
|
||||||
|
widths[165] = 500; // yen
|
||||||
|
widths[166] = 200; // brokenbar
|
||||||
|
widths[167] = 500; // section
|
||||||
|
widths[168] = 333; // dieresis
|
||||||
|
widths[169] = 759; // copyright
|
||||||
|
widths[170] = 275; // ordfeminine
|
||||||
|
widths[171] = 500; // guillemotleft
|
||||||
|
widths[172] = 563; // logicalnot
|
||||||
|
widths[173] = 333; // sfthyphen
|
||||||
|
widths[174] = 759; // registered
|
||||||
|
widths[175] = 500; // overscore
|
||||||
|
widths[176] = 399; // degree
|
||||||
|
widths[177] = 548; // plusminus
|
||||||
|
widths[178] = 299; // twosuperior
|
||||||
|
widths[179] = 299; // threesuperior
|
||||||
|
widths[180] = 333; // acute
|
||||||
|
widths[181] = 576; // mu1
|
||||||
|
widths[182] = 453; // paragraph
|
||||||
|
widths[183] = 333; // middot
|
||||||
|
widths[184] = 333; // cedilla
|
||||||
|
widths[185] = 299; // onesuperior
|
||||||
|
widths[186] = 310; // ordmasculine
|
||||||
|
widths[187] = 500; // guillemotright
|
||||||
|
widths[188] = 750; // onequarter
|
||||||
|
widths[189] = 750; // onehalf
|
||||||
|
widths[190] = 750; // threequarters
|
||||||
|
widths[191] = 443; // questiondown
|
||||||
|
widths[192] = 722; // Agrave
|
||||||
|
widths[193] = 722; // Aacute
|
||||||
|
widths[194] = 722; // Acircumflex
|
||||||
|
widths[195] = 722; // Atilde
|
||||||
|
widths[196] = 722; // Adieresis
|
||||||
|
widths[197] = 722; // Aring
|
||||||
|
widths[198] = 889; // AE
|
||||||
|
widths[199] = 666; // Ccedilla
|
||||||
|
widths[200] = 610; // Egrave
|
||||||
|
widths[201] = 610; // Eacute
|
||||||
|
widths[202] = 610; // Ecircumflex
|
||||||
|
widths[203] = 610; // Edieresis
|
||||||
|
widths[204] = 333; // Igrave
|
||||||
|
widths[205] = 333; // Iacute
|
||||||
|
widths[206] = 333; // Icircumflex
|
||||||
|
widths[207] = 333; // Idieresis
|
||||||
|
widths[208] = 722; // Eth
|
||||||
|
widths[209] = 722; // Ntilde
|
||||||
|
widths[210] = 722; // Ograve
|
||||||
|
widths[211] = 722; // Oacute
|
||||||
|
widths[212] = 722; // Ocircumflex
|
||||||
|
widths[213] = 722; // Otilde
|
||||||
|
widths[214] = 722; // Odieresis
|
||||||
|
widths[215] = 563; // multiply
|
||||||
|
widths[216] = 722; // Oslash
|
||||||
|
widths[217] = 722; // Ugrave
|
||||||
|
widths[218] = 722; // Uacute
|
||||||
|
widths[219] = 722; // Ucircumflex
|
||||||
|
widths[220] = 722; // Udieresis
|
||||||
|
widths[221] = 722; // Yacute
|
||||||
|
widths[222] = 556; // Thorn
|
||||||
|
widths[223] = 500; // germandbls
|
||||||
|
widths[224] = 443; // agrave
|
||||||
|
widths[225] = 443; // aacute
|
||||||
|
widths[226] = 443; // acircumflex
|
||||||
|
widths[227] = 443; // atilde
|
||||||
|
widths[228] = 443; // adieresis
|
||||||
|
widths[229] = 443; // aring
|
||||||
|
widths[230] = 666; // ae
|
||||||
|
widths[231] = 443; // ccedilla
|
||||||
|
widths[232] = 443; // egrave
|
||||||
|
widths[233] = 443; // eacute
|
||||||
|
widths[234] = 443; // ecircumflex
|
||||||
|
widths[235] = 443; // edieresis
|
||||||
|
widths[236] = 277; // igrave
|
||||||
|
widths[237] = 277; // iacute
|
||||||
|
widths[238] = 277; // icircumflex
|
||||||
|
widths[239] = 277; // idieresis
|
||||||
|
widths[240] = 500; // eth
|
||||||
|
widths[241] = 500; // ntilde
|
||||||
|
widths[242] = 500; // ograve
|
||||||
|
widths[243] = 500; // oacute
|
||||||
|
widths[244] = 500; // ocircumflex
|
||||||
|
widths[245] = 500; // otilde
|
||||||
|
widths[246] = 500; // odieresis
|
||||||
|
widths[247] = 548; // divide
|
||||||
|
widths[248] = 500; // oslash
|
||||||
|
widths[249] = 500; // ugrave
|
||||||
|
widths[250] = 500; // uacute
|
||||||
|
widths[251] = 500; // ucircumflex
|
||||||
|
widths[252] = 500; // udieresis
|
||||||
|
widths[253] = 500; // yacute
|
||||||
|
widths[254] = 500; // thorn
|
||||||
|
widths[255] = 500; // ydieresis
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -182,7 +182,7 @@ public class TreePostScriptGenerator {
|
||||||
i.addChild(k);
|
i.addChild(k);
|
||||||
Trees.writePS(t, null,
|
Trees.writePS(t, null,
|
||||||
"/Users/parrt/antlr/code/antlr4/main/tool/playground/t.eps",
|
"/Users/parrt/antlr/code/antlr4/main/tool/playground/t.eps",
|
||||||
"Arial", 11);
|
"ArialNarrow", 11);
|
||||||
// TreePostScriptGenerator psgen = new TreePostScriptGenerator(null, t, "CourierNew", 11);
|
// TreePostScriptGenerator psgen = new TreePostScriptGenerator(null, t, "CourierNew", 11);
|
||||||
// System.out.println(psgen.getPS());
|
// System.out.println(psgen.getPS());
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,13 +29,10 @@
|
||||||
|
|
||||||
package org.antlr.v4.runtime.tree.gui;
|
package org.antlr.v4.runtime.tree.gui;
|
||||||
|
|
||||||
import org.abego.treelayout.NodeExtentProvider;
|
import org.abego.treelayout.*;
|
||||||
import org.abego.treelayout.TreeForTreeLayout;
|
|
||||||
import org.abego.treelayout.TreeLayout;
|
|
||||||
import org.abego.treelayout.util.DefaultConfiguration;
|
import org.abego.treelayout.util.DefaultConfiguration;
|
||||||
import org.antlr.v4.runtime.BaseRecognizer;
|
import org.antlr.v4.runtime.BaseRecognizer;
|
||||||
import org.antlr.v4.runtime.tree.Tree;
|
import org.antlr.v4.runtime.tree.*;
|
||||||
import org.antlr.v4.runtime.tree.Trees;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
@ -145,11 +142,16 @@ public class TreeViewer extends JComponent {
|
||||||
int x = (int) box.x + arcSize / 2 + nodeWidthPadding;
|
int x = (int) box.x + arcSize / 2 + nodeWidthPadding;
|
||||||
int y = (int) box.y + m.getAscent() + m.getLeading() + 1 + nodeHeightPadding;
|
int y = (int) box.y + m.getAscent() + m.getLeading() + 1 + nodeHeightPadding;
|
||||||
for (int i = 0; i < lines.length; i++) {
|
for (int i = 0; i < lines.length; i++) {
|
||||||
g.drawString(lines[i], x, y);
|
// g.drawString(lines[i], x, y);
|
||||||
|
text(g, lines[i], x, y);
|
||||||
y += m.getHeight();
|
y += m.getHeight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void text(Graphics g, String s, int x, int y) {
|
||||||
|
g.drawString(s, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g) {
|
public void paint(Graphics g) {
|
||||||
super.paint(g);
|
super.paint(g);
|
||||||
|
|
Loading…
Reference in New Issue