summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtkread20
1 files changed, 13 insertions, 7 deletions
diff --git a/tkread b/tkread
index b4f9f2e..ce4bac0 100755
--- a/tkread
+++ b/tkread
@@ -29,9 +29,12 @@ set tagnum 0
set domarkdown 0
set surroundfmt { \
- {"***" "bold italic"} \
- {"**" "bold"} \
- {"*" "italic"} \
+ {"***" "0" "bold italic"} \
+ {"**" "0" "bold"} \
+ {"*" "0" "italic"} \
+ {"===" "0" "italic"} \
+ {"==" "3" "italic"} \
+ {"=" "6" ""} \
}
package require Tk
@@ -55,7 +58,8 @@ proc markup {widget} {
foreach fmt $surroundfmt {
set searchchar [lindex $fmt 0]
- set fmtstring [lindex $fmt 1]
+ set fmtsizemod [lindex $fmt 1]
+ set fmtstring [lindex $fmt 2]
set searchlen [string length $searchchar]
set insection 0
set cur ""
@@ -87,7 +91,8 @@ proc markup {widget} {
$widget tag add tag_$tagnum markon_$x markoff_$x
}
- $widget tag configure tag_$tagnum -font "{$fontfamily} $fontsize $fmtstring"
+ # TODO: change in changeFontSize too if this works
+ $widget tag configure tag_$tagnum -font "{$fontfamily} [expr $fontsize + $fmtsizemod] $fmtstring"
incr tagnum
}
}
@@ -102,8 +107,9 @@ proc changeFontSize {change} {
set fontsize $newsize
.t configure -font "{$fontfamily} $fontsize" -padx [expr $fontsize * 3]
for {set x 0} {$x < $tagnum} {incr x} {
- set fmtstring [lindex [lindex $surroundfmt $x] 1]
- .t tag configure tag_$x -font "{$fontfamily} $fontsize $fmtstring"
+ set fmtstring [lindex [lindex $surroundfmt $x] 2]
+ set fmtsizemod [lindex [lindex $surroundfmt $x] 1]
+ .t tag configure tag_$x -font "{$fontfamily} [expr $fontsize + $fmtsizemod] $fmtstring"
}
}
}