📄 font.test
字号:
} {-family fixed}test font-13.3 {Tk_FreeFont procedure: named font} { setup font create xyz .b.f config -font xyz destroy .b.f font names} {xyz}test font-13.4 {Tk_FreeFont procedure: named font} { setup font create xyz -underline 1 .b.f config -font xyz font delete xyz set x [font actual xyz -underline] destroy .b.f list [font actual xyz -underline] $x} {0 1}test font-13.5 {Tk_FreeFont procedure: named font not deleted yet} { setup font create xyz .b.f config -font xyz button .b.b -font xyz font delete xyz set x [font actual xyz] destroy .b.b list [lindex [font actual xyz] 0] [lindex $x 0]} {-family -family}test font-14.1 {Tk_FontId} { .b.f config -font "times 20" update} {}test font-15.1 {Tk_FontMetrics procedure} { button .b.w1 -text abc entry .b.w2 -text abcd update destroy .b.w1 .b.w2} {}proc psfontname {name} { set a [.b.c itemcget text -font] .b.c itemconfig text -font $name set post [.b.c postscript] .b.c itemconfig text -font $a set end [string first "findfont" $post] incr end -2 set post [string range $post [expr $end-70] $end] set start [string first "gsave" $post] return [string range $post [expr $start+7] end]}test font-16.1 {Tk_PostscriptFontName procedure: native} {unixOnly} { set x [font actual {{itc avant garde} 10} -family] if {[string match *avant*garde $x]} { psfontname "{itc avant garde} 10" } else { set x {AvantGarde-Book} }} {AvantGarde-Book}test font-16.2 {Tk_PostscriptFontName procedure: native} {pcOnly} { psfontname "arial 10"} {Helvetica}test font-16.3 {Tk_PostscriptFontName procedure: native} {pcOnly} { psfontname "{times new roman} 10"} {Times-Roman}test font-16.4 {Tk_PostscriptFontName procedure: native} {pcOnly} { psfontname "{courier new} 10"} {Courier}test font-16.5 {Tk_PostscriptFontName procedure: native} {macOnly} { psfontname "geneva 10"} {Helvetica}test font-16.6 {Tk_PostscriptFontName procedure: native} {macOnly} { psfontname "{new york} 10"} {Times-Roman}test font-16.7 {Tk_PostscriptFontName procedure: native} {macOnly} { psfontname "monaco 10"} {Courier}test font-16.8 {Tk_PostscriptFontName procedure: spaces} {unixOnly} { set x [font actual {{lucida bright} 10} -family] if {[string match lucida*bright $x]} { psfontname "{lucida bright} 10" } else { set x {LucidaBright} }} {LucidaBright}test font-16.9 {Tk_PostscriptFontName procedure: spaces} {unixOnly} { psfontname "{new century schoolbook} 10"} {NewCenturySchlbk-Roman}set i 10foreach p { {"avantgarde" AvantGarde-Book AvantGarde-Demi AvantGarde-BookOblique AvantGarde-DemiOblique} {"bookman" Bookman-Light Bookman-Demi Bookman-LightItalic Bookman-DemiItalic} {"courier" Courier Courier-Bold Courier-Oblique Courier-BoldOblique} {"helvetica" Helvetica Helvetica-Bold Helvetica-Oblique Helvetica-BoldOblique} {"new century schoolbook" NewCenturySchlbk-Roman NewCenturySchlbk-Bold NewCenturySchlbk-Italic NewCenturySchlbk-BoldItalic} {"palatino" Palatino-Roman Palatino-Bold Palatino-Italic Palatino-BoldItalic} {"symbol" Symbol Symbol Symbol Symbol} {"times" Times-Roman Times-Bold Times-Italic Times-BoldItalic} {"zapfchancery" ZapfChancery-MediumItalic ZapfChancery-MediumItalic ZapfChancery-MediumItalic ZapfChancery-MediumItalic} {"zapfdingbats" ZapfDingbats ZapfDingbats ZapfDingbats ZapfDingbats}} { test font-16.$i {Tk_PostscriptFontName procedure: exhaustive} {unixOnly} { set family [lindex $p 0] set x {} set i 1 foreach slant {roman italic} { foreach weight {normal bold} { set name [list $family 12 $slant $weight] if {[font actual $name -family] == $family} { lappend x [psfontname $name] } else { lappend x [lindex $p $i] } incr i } } incr i set x } [lrange $p 1 end]}foreach p { {"arial" Helvetica Helvetica-Bold Helvetica-Oblique Helvetica-BoldOblique} {"courier new" Courier Courier-Bold Courier-Oblique Courier-BoldOblique} {"helvetica" Helvetica Helvetica-Bold Helvetica-Oblique Helvetica-BoldOblique} {"symbol" Symbol Symbol-Bold Symbol-Italic Symbol-BoldItalic} {"times new roman" Times-Roman Times-Bold Times-Italic Times-BoldItalic}} { test font-16.$i {Tk_PostscriptFontName procedure: exhaustive} {pcOnly} { set family [lindex $p 0] set x {} foreach slant {roman italic} { foreach weight {normal bold} { lappend x [psfontname [list $family 12 "$slant $weight"]] } } incr i set x } [lrange $p 1 end]}foreach p { {"courier" Courier Courier-Bold Courier-Oblique Courier-BoldOblique} {"geneva" Helvetica Helvetica-Bold Helvetica-Oblique Helvetica-BoldOblique} {"helvetica" Helvetica Helvetica-Bold Helvetica-Oblique Helvetica-BoldOblique} {"monaco" Courier Courier-Bold Courier-Oblique Courier-BoldOblique} {"new york" Times-Roman Times-Bold Times-Italic Times-BoldItalic} {"symbol" Symbol Symbol-Bold Symbol-Italic Symbol-BoldItalic} {"times" Times-Roman Times-Bold Times-Italic Times-BoldItalic}} { test font-16.$i {Tk_PostscriptFontName procedure: exhaustive} {macOnly} { set family [lindex $p 0] set x {} foreach slant {roman italic} { foreach weight {normal bold} { lappend x [psfontname [list $family 12 $slant $weight]] } } incr i set x } [lrange $p 1 end]}test font-17.1 {Tk_UnderlineChars procedure} { text .b.t .b.t insert 1.0 abc\tdefg .b.t tag config sel -underline 1 .b.t tag add sel 1.0 end update} {}setuptest font-18.1 {Tk_ComputeTextLayout: empty string} { .b.l config -text ""} {}test font-18.2 {Tk_ComputeTextLayout: simple string} { .b.l config -text "000" getsize} "[expr $ax*3] $ay"test font-18.3 {Tk_ComputeTextLayout: find special chars} { .b.l config -text "000\n000" getsize} "[expr $ax*3] [expr $ay*2]"test font-18.4 {Tk_ComputeTextLayout: calls Tk_MeasureChars} { .b.l config -text "000\n000" getsize} "[expr $ax*3] [expr $ay*2]"test font-18.5 {Tk_ComputeTextLayout: break line} { .b.l config -text "000\t00000" -wrap [expr 9*$ax] set x [getsize] .b.l config -wrap 0 set x} "[expr 8*$ax] [expr 2*$ay]"test font-18.6 {Tk_ComputeTextLayout: normal ended on special char} { .b.l config -text "000\n000"} {}test font-18.7 {Tk_ComputeTextLayout: special char was \n} { .b.l config -text "000\n0000" getsize} "[expr $ax*4] [expr $ay*2]"test font-18.8 {Tk_ComputeTextLayout: special char was \t} { .b.l config -text "000\t00" getsize} "[expr $ax*10] $ay"test font-18.9 {Tk_ComputeTextLayout: tab didn't cause break} { set x {} .b.l config -text "000\t000" lappend x [getsize] .b.l config -text "000\t000" -wrap [expr 100*$ax] lappend x [getsize] .b.l config -wrap 0 set x} "{[expr $ax*11] $ay} {[expr $ax*11] $ay}"test font-18.10 {Tk_ComputeTextLayout: tab caused break} { set x {} .b.l config -text "000\t" lappend x [getsize] .b.l config -text "000\t00" -wrap [expr $ax*6] lappend x [getsize] .b.l config -wrap 0 set x} "{[expr $ax*3] $ay} {[expr $ax*3] [expr $ay*2]}"test font-18.11 {Tk_ComputeTextLayout: absorb spaces at eol} { set x {} .b.l config -text "000 000" -wrap [expr $ax*5] lappend x [getsize] .b.l config -text "000 " lappend x [getsize] .b.l config -wrap 0 set x} "{[expr $ax*3] [expr $ay*2]} {[expr $ax*3] $ay}"test font-18.12 {Tk_ComputeTextLayout: append non-printing spaces to chunk} { set x {} .b.l config -text "000 0000" -wrap [expr $ax*5] lappend x [getsize] .b.l config -text "000\t00 0000" -wrap [expr $ax*12] lappend x [getsize] .b.l config -wrap 0 set x} "{[expr $ax*4] [expr $ay*2]} {[expr $ax*10] [expr $ay*2]}"test font-18.13 {Tk_ComputeTextLayout: many lines -> realloc line array} { .b.l config -text "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" getsize} "1 [expr $ay*129]"test font-18.14 {Tk_ComputeTextLayout: text ended with \n} { list [.b.l config -text "0000"; getsize] [.b.l config -text "0000\n"; getsize]} "{[expr $ax*4] $ay} {[expr $ax*4] [expr $ay*2]}"test font-18.15 {Tk_ComputeTextLayout: justification} { csetup "000\n00000" set x {} .b.c itemconfig text -just left lappend x [.b.c index text @[expr $ax*2],0] .b.c itemconfig text -just center lappend x [.b.c index text @[expr $ax*2],0] .b.c itemconfig text -just right lappend x [.b.c index text @[expr $ax*2],0] .b.c itemconfig text -just left set x} {2 1 0}test font-19.1 {Tk_FreeTextLayout procedure} { setup .b.f config -text foo .b.f config -text boo} {} test font-20.1 {Tk_DrawTextLayout procedure: auto-detect last char} { .b.f config -text foo} {}test font-20.2 {Tk_DrawTextLayout procedure: multiple chunks} { csetup "000\t00\n000"} {}test font-20.3 {Tk_DrawTextLayout: draw subset of chunk: numDisplay <= 0} { csetup "000\t00" .b.c select from text 3 .b.c select to text 5} {}test font-20.4 {Tk_DrawTextLayout: draw subset of chunk: firstChar <= 0} { .b.c select from text 3 .b.c select to text 5} {}test font-20.5 {Tk_DrawTextLayout: draw subset of chunk: firstChar > 0} { .b.c select from text 2 .b.c select to text 2} {}test font-20.6 {Tk_DrawTextLayout: draw subset of chunk: lastChar < numChars} { .b.c select from text 4 .b.c select to text 4} {}test font-21.1 {Tk_UnderlineTextLayout procedure: no underline chosen} { .b.f config -text "foo" -under -1} {}test font-21.2 {Tk_UnderlineTextLayout procedure: underline not visible} { .b.f config -text "000 00000" -wrap [expr $ax*7] -under 10} {}test font-21.3 {Tk_UnderlineTextLayout procedure: underline is visible} { .b.f config -text "000 00000" -wrap [expr $ax*7] -under 5 .b.f config -wrap -1 -under -1} {} test font-22.1 {Tk_PointToChar procedure: above all lines} { csetup "000" .b.c index text @-1,0} {0}test font-22.2 {Tk_PointToChar procedure: no chars} { # After fixing the following bug: # # In canvas text item, it was impossible to click to position the # insertion point just after the last character. # # introduced another bug that Tk_PointToChar() would return a character # index of 1 if TextLayout contained 0 characters. csetup "" .b.c index text @100,100} {0}test font-22.3 {Tk_PointToChar procedure: loop test} { csetup "000\n000\n000\n000" .b.c index text @10000,0} {3}test font-22.4 {Tk_PointToChar procedure: intersect line} { csetup "000\n000\n000" .b.c index text @0,$ay} {4}test font-22.5 {Tk_PointToChar procedure: to the left of all chunks} { .b.c index text @-100,$ay} {4}test font-22.6 {Tk_PointToChar procedure: past any possible chunk} { .b.c index text @100000,$ay} {7}test font-22.7 {Tk_PointToChar procedure: which chunk on this line} { csetup "000\n000\t000\t000\n000" .b.c index text @[expr $ax*2],$ay} {6}test font-22.8 {Tk_PointToChar procedure: which chunk on this line} { csetup "000\n000\t000\t000\n000" .b.c index text @[expr $ax*10],$ay} {10}test font-22.9 {Tk_PointToChar procedure: in special chunk} { csetup "000\n000\t000\t000\n000" .b.c index text @[expr $ax*6],$ay} {7}test font-22.10 {Tk_PointToChar procedure: past all chars in chunk} { csetup "000 0000000" .b.c itemconfig text -width [expr $ax*5] set x [.b.c index text @[expr $ax*5],0] .b.c itemconfig text -width 0 set x} {3}test font-22.11 {Tk_PointToChar procedure: below all chunks} { csetup "000 0000000" .b.c index text @0,1000000} {11} test font-23.1 {Tk_CharBBox procedure: index < 0} { .b.f config -text "000" -underline -1} {}test font-23.2 {Tk_CharBBox procedure: loop} { .b.f config -text "000\t000\t000\t000" -underline 9} {}test font-23.3 {Tk_CharBBox procedure: special char} { .b.f config -text "000\t000\t000" -underline 7} {}test font-23.4 {Tk_CharBBox procedure: normal char} { .b.f config -text "000" -underline 1} {}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -