font actual & cget problem 
Author Message
 font actual & cget problem

Hi, All!

I need to make tag for text widget with current font but bold
weight. First, I've tried the code below to examine the font:

  option add *font {-*-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*}

  text .t
  .t insert end sample
  pack .t

  puts [.t cget -font]
  puts [font actual [.t cget -font]]

And got the difference:

  -*-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*
  -family helvetica -size 9 -weight normal -slant roman \
      -underline 0 -overstrike 0

Is this a bug? And if is, however, how to correctly get current font
size?

--
For replay, reverse my login & remove all numbers in it



Sun, 27 Jan 2008 22:44:23 GMT  
 font actual & cget problem

Quote:
> Hi, All!

> I need to make tag for text widget with current font but bold
> weight. First, I've tried the code below to examine the font:

>   option add *font {-*-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*}

>   text .t
>   .t insert end sample
>   pack .t

>   puts [.t cget -font]
>   puts [font actual [.t cget -font]]

> And got the difference:

>   -*-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*
>   -family helvetica -size 9 -weight normal -slant roman \
>       -underline 0 -overstrike 0

> Is this a bug? And if is, however, how to correctly get current font
> size?

Aha! It works fine if we create named font:

  font create myfont -family Helvetica -size 10
  option add *font myfont

  text .t
  .t insert end sample
  pack .t

  puts [font actual [.t cget -font]]

==> -family helvetica -size 10 -weight normal \
       -slant roman -underline 0 -overstrike 0

--
For replay, reverse my login & remove all numbers in it



Mon, 28 Jan 2008 05:45:38 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Tk system fonts don't match actual system fonts

2. font actual mystery

3. tk X11 [font actual] bug?

4. possible "font actual" bug

5. bug in font actual

6. BUG? font / actual

7. Win32 actual fonts

8. Font problem & instalation

9. Problem with Small Fonts Big Fonts

10. Actual Argument & Dummy Argument question

11. F90: Internal & actual procedures

12. Tk8.0 problems: tk_popup: bug+fix, font problem

 

 
Powered by phpBB® Forum Software