|
List Info
Thread: What is wx.Font pointSize?
|
|
| What is wx.Font pointSize? |

|
2007-11-06 08:46:21 |
|
Hi list,
I39;m playing a little bit with fonts recently and I'm trying to understand what is pointSize. I mean, I look at an image like this one:
http://en.wikipedia.org/wiki/Image:Typography_Line_Terms.svg and I ask myself. "What is pointSize?" I thought it should be Ascent+Descent?
Zooming in and measuring the actual size of the text doesn't help. It looks like the size is only the distance between baseline and cap size with the drawing having an offset equal to the distance between cap size line and ascent line.
attached is an image produced by the following code:
pdc = wx.PaintDC(self) pdc.SetPen(wx.Pen("red",1)) pdc.DrawLine(100,100,100,200) pdc.DrawLine(50,100,300,100)
pdc.DrawLine(50,109,300,109) pdc.SetFont(wx.Font(9, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False)) pdc.DrawText("Test jjllgg", 100, 100) pdc.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL
, wx.NORMAL, False)) pdc.DrawText("Test jjllgg", 200, 100)
I9;ve added zoom-ins for 3X and 9X to make the situation more obvious.
What should I understand from what I see?
Any of you has some insights on how to efficiently use the fonts?
Thank you in advance. Peter
-- There is NO FATE, we are the creators.
|
 |
| View Original Image |
| Getting mouse events outside the
control |

|
2007-11-06 10:06:16 |
|
| Hello,
Simple
question, I have a control, its got focus, but then the user clics somewhere
else (desktop lets say).
How do
I catch a mouse event outside a window.
Tom |
| Re: What is wx.Font pointSize? |

|
2007-11-06 11:34:56 |
Peter Damoc wrote:
> Hi list,
>
> I'm playing a little bit with fonts recently and I'm
trying to
> understand what is pointSize.
> I mean, I look at an image like this one:
> http://en.wikipedia.org/wiki/Image:Typography_Line_T
erms.svg
> and I ask myself. "What is pointSize?" I
thought it should be
> Ascent+Descent?
Points is a typography metric that comes from the old days
of the hand
cranked printing press. A point is 1/72 of an inch, which
means that if
you are setting type into a press that is 72 points then the
height of
the type glyphs you are putting in the press is about one
inch high.
How that translates into pixels on a screen or dots on a
page depends on
the DPI of the device, and whether or not the OS actually
uses that DPI
or just assumes something like 96dpi for everything.
(cough-microsoft-cough!)
>
> Zooming in and measuring the actual size of the text
doesn't help. It
> looks like the size is only the distance between
baseline and cap size
> with the drawing having an offset equal to the distance
between cap size
> line and ascent line.
You can't assume that points equals pixels, because most of
the time
they won't. Also keep printing in mind. If you have a 14
point font on
screen, let's say that it is using text that is about 20
pixels high.
If you now run that through to the printer then in order to
have the
scaling right so you can actually read the text, then it
could easily be
as much as a few hundred dots high on the page, depending on
the dpi of
the printer.
You can however create a font based on pixel size instead of
points.
There is an alternate constructor called
wx.FontFromPixelSize that takes
a wx.Size as the first parameter instead of an integer.
It's fairly new
so I haven't used it myself, but I have been told that the
different
platforms deal with the width part of that size object
differently, so
you'll probably want to experiment with it a bit to get a
feel for how
it works.
BTW, here is some other nearly useless trivia: a point is
1/12 of a pica.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java
give you jitters? Relax with wxPython!
------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribe lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help lists.wxwidgets.org
|
|
| Re: Getting mouse events outside the
control |

|
2007-11-06 11:35:47 |
Pajak, Tom (GE Healthcare) wrote:
> Hello,
>
> Simple question, I have a control, its got focus, but
then the user
> clics somewhere else (desktop lets say).
>
> How do I catch a mouse event outside a window.
If you want all mouse events to be sent to your widget then
it can
capture the mouse with... wait for it... the CaptureMouse()
method.
After that has been done then all mouse events will be sent
to this
widget until you call ReleaseMouse() or the system decides
that it needs
to steal the capture from you for some reason. (You'll get
a capture
lost event in that case.) Be sure to have a way to release
the mouse
otherwise you can get stuck and not be able to do things
like close your
own application. In the demo there are a couple examples of
using
CaptureMouse.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java
give you jitters? Relax with wxPython!
------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribe lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help lists.wxwidgets.org
|
|
| Re: What is wx.Font pointSize? |

|
2007-11-06 11:39:20 |
Robin Dunn wrote:
> Peter Damoc wrote:
>> Hi list,
>>
>> I'm playing a little bit with fonts recently and
I'm trying to
>> understand what is pointSize.
>> I mean, I look at an image like this one:
>> http://en.wikipedia.org/wiki/Image:Typography_Line_T
erms.svg
>> and I ask myself. "What is pointSize?" I
thought it should be
>> Ascent+Descent?
>
> Points is a typography metric that comes from the old
days of the hand
> cranked printing press. A point is 1/72 of an inch,
which means that if
> you are setting type into a press that is 72 points
then the height of
> the type glyphs you are putting in the press is about
one inch high.
Looks like there is a long history involved here:
http://en.wik
ipedia.org/wiki/Point_size
--
Robin Dunn
Software Craftsman
http://wxPython.org Java
give you jitters? Relax with wxPython!
------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribe lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help lists.wxwidgets.org
|
|
| Re: What is wx.Font pointSize? |

|
2007-11-06 12:25:49 |
Robin Dunn wrote:
> Peter Damoc wrote:
>> I'm trying to understand what is pointSize.
>> I mean, I look at an image like this one:
>> http://en.wikipedia.org/wiki/Image:Typography_Line_T
erms.svg
>> and I ask myself. "What is pointSize?" I
thought it should be
>> Ascent+Descent?
Robin answered the question of what is a pointSize vs. pixel
size, etc,
but I think the OP had a slightly different question.
As far as I know, the "Point Size" (or pixel size,
for that matter) is a
nominal dimension. As there are a lot of ways to measure a
font --
Ascender height, descender height, etc, and each character
in the font
is different, and each font is different. I think you might
as well just
think of it as a nominal size -- like a 2X4 is not 2"
by 4", and a 1"
pipe is not 1", etc.
If I had to guess, I'd say that the "size" of a
font probably is about
the cap height.
What's too bad is that wx does not provide a way to get
measurements
to-from the baseline, or anything like that -- it's been
proposed, but I
don't know if anyone is actually working on it.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker noaa.gov
------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribe lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help lists.wxwidgets.org
|
|
| Re: What is wx.Font pointSize? |

|
2007-11-06 13:07:58 |
|
Ok,
Some more details... I was trying to study for the implementation of a "drawn" toolkit. Basic controls. I started with the buttons. I looked at the best, Apple HIG... I tried to use their suggestions of 13 points font... BUT the buttons looked huge.
How would one draw consistent looking buttons, how would one align the text in these buttons. Right now is more of an empirical thing: add another pixel to the offset, use a smaller font.
Peter.
On 11/6/07, Robin Dunn < robin alldunn.com">robin alldunn.com> wrote:
Peter Damoc wrote: > Hi list, > > I'm playing a little bit with fonts recently and I'm trying to > understand what is pointSize. > I mean, I look at an image like this one: >
http://en.wikipedia.org/wiki/Image:Typography_Line_Terms.svg > and I ask myself. "What is pointSize?" I thought it should be > Ascent+Descent?
Points is a typography metric that comes from the old days of the hand
cranked printing press. A point is 1/72 of an inch, which means that if you are setting type into a press that is 72 points then the height of the type glyphs you are putting in the press is about one inch high.
How that translates into pixels on a screen or dots on a page depends on the DPI of the device, and whether or not the OS actually uses that DPI or just assumes something like 96dpi for everything. (cough-microsoft-cough!)
> > Zooming in and measuring the actual size of the text doesn't help. It > looks like the size is only the distance between baseline and cap size > with the drawing having an offset equal to the distance between cap size
> line and ascent line.
You can't assume that points equals pixels, because most of the time they won't. Also keep printing in mind. If you have a 14 point font on screen, let's say that it is using text that is about 20 pixels high.
If you now run that through to the printer then in order to have the scaling right so you can actually read the text, then it could easily be as much as a few hundred dots high on the page, depending on the dpi of
the printer.
You can however create a font based on pixel size instead of points. There is an alternate constructor called wx.FontFromPixelSize that takes a wx.Size as the first parameter instead of an integer. It's fairly new
so I haven't used it myself, but I have been told that the different platforms deal with the width part of that size object differently, so you';ll probably want to experiment with it a bit to get a feel for how
it works.
BTW, here is some other nearly useless trivia: a point is 1/12 of a pica.
-- Robin Dunn Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
--------------------------------------------------------------------- To unsubscribe, e-mail: wxPython-users-unsubscribe lists.wxwidgets.org">wxPython-users-unsubscribe lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help lists.wxwidgets.org">wxPython-users-help lists.wxwidgets.org
-- There is NO FATE, we are the creators.
|
| Re: What is wx.Font pointSize? |

|
2007-11-07 00:21:37 |
Peter Damoc wrote:
> Some more details... I was trying to study for the
implementation of a
> "drawn" toolkit. Basic controls. I started
with the buttons.
> I looked at the best, Apple HIG... I tried to use their
suggestions of
> 13 points font... BUT the buttons looked huge.
I think you've hit one of my pet peeves -- systems that let
you specify
font size in "points", where other stuff is in
pixels. The truth is that
points make no sense in computers -- you need to know how
many dpi your
display is -- but then, if you project on a big screen, do
you want
your fonts 13/72 of an inch tall? of course not!
In your case, if the font is huge, it's probably because the
system has
the wrong dpi setting. Until we get fully scalable
everything (has Apple
achieved that?), try to use a pixel size to set fonts if you
can.
> How would one draw consistent looking buttons, how
would one align the
> text in these buttons.
That's a bit tough, as wx only gives you crude
DC.GetTextExtent -- and
you can't draw text lined up at the baseline either.
Does GraphicsContext help this???
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker noaa.gov
------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribe lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help lists.wxwidgets.org
|
|
[1-8]
|
|