Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Get the size in pixels for a string
Stéphane Thibaudeau
3/29/2006 2:36:00 PM
Hi list !
Id like to know the width and height in pixels for a string given a
font family, size and style.
How could I do that ?
Thanks,
Stéphane.
1 Answer
Chris Alfeld
3/29/2006 3:00:00 PM
0
This is undoubtedly overkill, but:
require 'tk'
f = TkFont.new('Courier 10')
width = f.measure("Hi There!")
height = f.metrics.assoc('linespace')[1]
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Get the size in pixels for a string
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password