Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32120
Modified Files: Tag: devel_0_39 desire.tk Log Message: more on font bomb
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.406 retrieving revision 1.1.2.407 diff -C2 -d -r1.1.2.406 -r1.1.2.407 *** desire.tk 25 Aug 2006 16:24:35 -0000 1.1.2.406 --- desire.tk 25 Aug 2006 23:06:10 -0000 1.1.2.407 *************** *** 511,514 **** --- 511,515 ---- set font(name) courier set font(style) normal + set font(italic) 0 set font(str2) "-*-courier-medium--normal--%d-*" set font(str) [format -*-courier-medium--normal--%d-* $font(size)] *************** *** 5850,5877 ****
def* FontBombDialog get_xlfd {name style size} { - #global bold italic fontsize set fstring "" ! set facename [.$self.font.list.box get [.$self.font.list.box curselection]] if {$style == "bold"} { ! set fstring "*-$facename-bold" } else { ! set fstring "*-$facename-medium" } ! if {$style == "italic"} { ! if {$facename == "Helvetica" || $facename == "Courier"} { ! set fstring "$fstring-o-normal--$size-*" } else { ! set fstring "$fstring-i-normal--$size-*" } } else { ! set fstring "$fstring-r-normal--$size-*" } - return $fstring }
! def* FontBombDialog resetfont {} { global font ! set xlfd [$self get_xlfd $font(name) $font(style) $@size] ! .$self.font2.preview.entry configure -font $xlfd }
--- 5851,5880 ----
def* FontBombDialog get_xlfd {name style size} { set fstring "" ! set list_pos [.$self.font.list.box curselection] ! if {$list_pos != ""} {set @font [.$self.font.list.box get [.$self.font.list.box curselection]]} if {$style == "bold"} { ! set fstring "*-$@font-bold" } else { ! set fstring "*-$@font-medium" } ! if {$@italic} { ! if {$@font == "Helvetica" || $@font == "Courier"} { ! set @str "$fstring-o-normal--$size-*" ! set @str2 "$fstring-o-normal--%d-*" } else { ! set @str "$fstring-i-normal--$size-*" ! set @str2 "$fstring-i-normal--%d-*" } } else { ! set @str "$fstring-r-normal--$size-*" ! set @str2 "$fstring-r-normal--%d-*" } }
! def* FontBombDialog update {} { global font ! $self get_xlfd $@font $@style $@size ! .$self.font2.preview.canvas itemconfigure ${self}TEXT -font $@str }
*************** *** 5882,5897 **** $f.font.size.entry delete 0 end $f.font.size.entry insert 0 $@size puts "$font(size)" }
def* FontBombDialog init {} { global font ! super reset cancel apply ok ! #$self add .fontbomb [say "fontbomb"] set f .$self - #wm geometry $f 346x334 bind all <KeyPress-F1> help - #set fontsize $font(size) set @size $font(size) set bold 0 set italic 0 --- 5885,5936 ---- $f.font.size.entry delete 0 end $f.font.size.entry insert 0 $@size + $self update puts "$font(size)" }
+ def* FontBombDialog style {style} { + if {$style != "italic"} { + if {$style == $@style} { set @style "normal" } else { set @style $style} + } + $self update + } + + def* FontBombDialog update_size {} { + set size [.$self.font.size.entry get] + puts " size $size" + if [regexp {^[0-9]+$} $size] {set @size $size} + $self update + } + + def* FontBombDialog apply {} { + global font + $self get_xlfd $@font $@style $@size + set font(size) $@size + set font(name) $@font + set font(style) $@style + set font(italic) $@italic + set font(str) $@str + set font(str2) $@str2 + set font(width) [font measure $@str W] + set font(height) [font metrics $@str -linespace] + puts " font :: $@font" + puts " size :: $@size" + puts " style :: $@style" + puts " italic :: $@italic" + puts " str :: $@str" + puts " str2 :: $@str2" + + } + def* FontBombDialog init {} { global font ! super cancel ok set f .$self bind all <KeyPress-F1> help set @size $font(size) + set @font $font(name) + set @style $font(style) + set @italic $font(italic) + set @fstr $font(str) set bold 0 set italic 0 *************** *** 5905,5909 **** # Insert the font names into the list box ! foreach name {Charter Clean Courier Helvetica Lucida LucidaBright\ LucidaTypewriter {New Century Schoolbook} Symbol Times\ fixed terminal} { --- 5944,5948 ---- # Insert the font names into the list box ! foreach name {Schumacher Utopia Charter Clean Courier Helvetica Lucida LucidaBright\ LucidaTypewriter {New Century Schoolbook} Symbol Times\ fixed terminal} { *************** *** 5911,5939 **** } ! bind $f.font.list.box <ButtonRelease-1> "$self resetfont" frame $f.font.size pack [label $f.font.size.label -text "Size:"] -side left pack [entry $f.font.size.entry -relief sunken -textvariable fontsize -width 4] -side left pack [scrollbar $f.font.size.scroll -command "$self changesize"] -side right -fill y $f.font.size.entry insert 0 $@size frame $f.font.style pack [label $f.font.style.label -text "Style:"] -side left -fill y ! pack [checkbutton $f.font.style.bold -text "Bold" -variable bold -command resetFont] -side top ! pack [checkbutton $f.font.style.italic -text "Italic" -variable italic -command resetFont] -side top frame $f.font2 frame $f.font2.preview pack [label $f.font2.preview.label -text "Preview:"] -side left -fill y ! pack [entry $f.font2.preview.entry -width 10 -relief sunken -textvariable previewtext] -side right ! $f.font2.preview.entry insert 0 "D351r3D474" ! ! pack $f.font.list -side left -fill y pack $f.font.size -side top -fill x pack $f.font.style -side top -fill x pack $f.font2.preview -side bottom - pack $f.font -side top pack $f.font2 -side bottom --- 5950,5978 ---- } ! bind $f.font.list.box <ButtonRelease-1> "$self update" frame $f.font.size pack [label $f.font.size.label -text "Size:"] -side left pack [entry $f.font.size.entry -relief sunken -textvariable fontsize -width 4] -side left + bind $f.font.size.entry <KeyPress-Return> "$self update_size" pack [scrollbar $f.font.size.scroll -command "$self changesize"] -side right -fill y + $f.font.size.entry delete 0 end $f.font.size.entry insert 0 $@size frame $f.font.style pack [label $f.font.style.label -text "Style:"] -side left -fill y ! pack [checkbutton $f.font.style.bold -text "Bold" -variable bold -command "$self style bold"] -side top ! pack [checkbutton $f.font.style.italic -text "Italic" -variable @italic -command "$self style italic"] -side top frame $f.font2 frame $f.font2.preview pack [label $f.font2.preview.label -text "Preview:"] -side left -fill y ! pack [canvas $f.font2.preview.canvas -width 200 -height 50 -relief sunken -borderwidth 1] -side right ! $f.font2.preview.canvas create text 10 25 -tags ${self}TEXT -anchor w -text "DesireData" -font $@fstr ! pack $f.font.list -side left -fill y pack $f.font.size -side top -fill x pack $f.font.style -side top -fill x pack $f.font2.preview -side bottom pack $f.font -side top pack $f.font2 -side bottom