I am attempting to extract the Font Names from the installed windows fonts.
I am having a heck of a time getting these rather than the file names.
Examples can be seen by going to Control Panel > Fonts
Any help or direction is appreciated.
S 11 3976
If you don't have a GUI library to use, TTFQuery+Fonttools will retrieve
this information:
from ttfquery import _scriptregistry
fonts = _scriptregistry.registry.fonts.keys()
fonts.sort()
for name in fonts:
print name
if you do have a GUI, your GUI library will almost certainly have a
mechanism to retrieve the list of fonts. With wxPython, for instance,
it's called wxFontEnumerator. If you just want the user to choose a
font, most GUI libraries already have controls/dialogues that can handle it.
TTFQuery is going out, reading the .ttf fonts with Fonttools and storing
their metadata in an index for faster access, whereas your GUI library
will be using a simple API call to retrieve the metadata. That means
TTFQuery is going to be heavier, but it can, for instance, also give you
information about fonts not installed on the system.
HTH,
Mike
TTFQuery: http://ttfquery.sourceforge.net/
Samantha wrote: I am attempting to extract the Font Names from the installed windows fonts. I am having a heck of a time getting these rather than the file names. Examples can be seen by going to Control Panel > Fonts
Any help or direction is appreciated. S
________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com
PyCon is coming...
Thanks Mike. I must have not installed the ttfquery and font tools
correctly. I get an error. This error:
Traceback (most recent call last):
File "C:\Python24\Lib\font-getter.py", line 1, in -toplevel-
from ttfquery import _scriptregistry
File "C:\Python24\Lib\site-packages\ttfquery\_scriptregistry.py", line 1,
in -toplevel-
from ttfquery import ttffiles
File "C:\Python24\Lib\site-packages\ttfquery\ttffiles.py", line 10,
in -toplevel-
from ttfquery import describe, findsystem
File "C:\Python24\Lib\site-packages\ttfquery\describe.py", line 2,
in -toplevel-
from fontTools import ttLib
ImportError: No module named fontTools
Like I said I think I am way in over my short head.
S
"Mike C. Fletcher" <mc******@rogers.com> wrote in message
news:ma***************************************@pyt hon.org... If you don't have a GUI library to use, TTFQuery+Fonttools will retrieve this information:
from ttfquery import _scriptregistry fonts = _scriptregistry.registry.fonts.keys() fonts.sort() for name in fonts: print name
if you do have a GUI, your GUI library will almost certainly have a mechanism to retrieve the list of fonts. With wxPython, for instance, it's called wxFontEnumerator. If you just want the user to choose a font, most GUI libraries already have controls/dialogues that can handle it.
TTFQuery is going out, reading the .ttf fonts with Fonttools and storing their metadata in an index for faster access, whereas your GUI library will be using a simple API call to retrieve the metadata. That means TTFQuery is going to be heavier, but it can, for instance, also give you information about fonts not installed on the system.
HTH, Mike
TTFQuery: http://ttfquery.sourceforge.net/
Samantha wrote:
I am attempting to extract the Font Names from the installed windows fonts. I am having a heck of a time getting these rather than the file names. Examples can be seen by going to Control Panel > Fonts
Any help or direction is appreciated. S ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com PyCon is coming...
[Samantha: your email has been bouncing, might want to clear your inbox]
Samantha wrote: Thanks Mike. I must have not installed the ttfquery and font tools correctly. I get an error. This error:
....
ImportError: No module named fontTools
Like I said I think I am way in over my short head. S
Does look as though you missed getting FontTools installed. You realise
it's a separate package from TTFQuery, right? http://sourceforge.net/projects/fonttools/
You'll have to do the standard:
python setup.py install
to get it installed on your system.
HTH,
Mike
________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com
PyCon is coming...
Mike,
Not sure why that email bounced.
I downloaded these files:
WinTTX2.0b1.exe
TTFQuery-1.0.0.win32.exe
numarray-1.1.1.win32-py2.4.exe
They all seemed to install. Is WinTTX2.0b1.exe not the fontTools file?
S
"Mike C. Fletcher" <mc******@rogers.com> wrote in message
news:ma***************************************@pyt hon.org... [Samantha: your email has been bouncing, might want to clear your inbox]
Samantha wrote:
Thanks Mike. I must have not installed the ttfquery and font tools correctly. I get an error. This error: ...
ImportError: No module named fontTools
Like I said I think I am way in over my short head. S Does look as though you missed getting FontTools installed. You realise it's a separate package from TTFQuery, right?
http://sourceforge.net/projects/fonttools/
You'll have to do the standard:
python setup.py install
to get it installed on your system.
HTH, Mike
________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com PyCon is coming...
"Samantha" <sa**********@hotmail.com> wrote: I am attempting to extract the Font Names from the installed windows fonts. I am having a heck of a time getting these rather than the file names. Examples can be seen by going to Control Panel > Fonts
here's one way to do it (using Tkinter): import Tkinter, tkFont tk = Tkinter.Tk() tkFont.families()
('System', 'Terminal', 'Fixedsys', 'Roman', 'Script', 'Modern', 'Small Fonts', 'MS Serif', ...)
here's another way (using PIL):
import os
from PIL import ImageFont
fontdir = os.path.join(os.environ["windir"], "fonts")
for fontfile in os.listdir(fontdir):
try:
font = ImageFont.truetype(os.path.join(fontdir, fontfile), 1)
except IOError:
pass
else:
print font.font.family, font.font.style
(this prints a list of family/style combinations). You can get PIL from http://www.pythonware.com/products/pil/ (1.1.4) http://effbot.org/downloads/#pil (1.1.5 betas)
</F>
Samantha wrote: Mike, Not sure why that email bounced.
That last one bounced too, btw.
I downloaded these files: WinTTX2.0b1.exe TTFQuery-1.0.0.win32.exe numarray-1.1.1.win32-py2.4.exe
They all seemed to install. Is WinTTX2.0b1.exe not the fontTools file?
I believe WinTTX is a font-editing program from which fontTools was
split out into a separate project.
As well, though I don't *know* that this will cause problems, I'd
thought fontTools required Numeric (Numpy) rather than Numarray. Would
try the fontTools package first with the Numarray you've installed, and
if you then find problems with it not being able to find Numeric,
install the Numpy release.
HTH,
Mike
________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com
PyCon is coming...
"Samantha" <sa**********@hotmail.com> wrote in message news:<B8********************@adelphia.com>... I am attempting to extract the Font Names from the installed windows fonts. I am having a heck of a time getting these rather than the file names. Examples can be seen by going to Control Panel > Fonts
Any help or direction is appreciated. S
Try this :
Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information. from Tkinter import Tk import tkFont root=Tk() print tkFont.families(root)
Thanks Fredrik,
The Tkinter method didn't give any results but using PIL did. I'll have to
play with it a little.
Thanks again,
S
"Fredrik Lundh" <fr*****@pythonware.com> wrote in message
news:ma***************************************@pyt hon.org... "Samantha" <sa**********@hotmail.com> wrote:
Mike,
Strange Hotmail.
I'll start over with the installs and you are correct on it being Numpy. I
got the wrong file.
I'll give it a go and let you know.
Thanks!!!!
S
"Mike C. Fletcher" <mc******@rogers.com> wrote in message
news:ma***************************************@pyt hon.org... Samantha wrote:
Thank you Pierre, that worked. I am still going to try and get the
TTFQuery+Fonttools to work just out of curiosity.
Thanks again to everyone!!!
S
"Pierre Quentel" <qu************@wanadoo.fr> wrote in message
news:32**************************@posting.google.c om... "Samantha" <sa**********@hotmail.com> wrote in message news:<B8********************@adelphia.com>... I am attempting to extract the Font Names from the installed windows fonts. I am having a heck of a time getting these rather than the file names. Examples can be seen by going to Control Panel > Fonts
Any help or direction is appreciated. S
Try this :
Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. from Tkinter import Tk import tkFont root=Tk() print tkFont.families(root)
Mike I did get the last msg. Still trying to get things under control.....
S
"Mike C. Fletcher" <mc******@rogers.com> wrote in message
news:ma***************************************@pyt hon.org... Samantha wrote:
Mike, Not sure why that email bounced. That last one bounced too, btw.
I downloaded these files: WinTTX2.0b1.exe TTFQuery-1.0.0.win32.exe numarray-1.1.1.win32-py2.4.exe
They all seemed to install. Is WinTTX2.0b1.exe not the fontTools file? I believe WinTTX is a font-editing program from which fontTools was split out into a separate project.
As well, though I don't *know* that this will cause problems, I'd thought fontTools required Numeric (Numpy) rather than Numarray. Would try the fontTools package first with the Numarray you've installed, and if you then find problems with it not being able to find Numeric, install the Numpy release.
HTH, Mike
________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com PyCon is coming... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Eric |
last post by:
Hey Everyone..
I have a form that has approximately 7 text fields and 1 checkbox.
Generally when this form is submitted(to itself BTW) it works fine,
however, when the checkbox is only field...
|
by: Robert Muchacki |
last post by:
Hello all!
I'm fighting with this little problem. I'm trying to retrieve data from a
table in SQL Server 2k. I'm dead. The only result I get is retrieving the
headers of the columns - no data in...
|
by: Paul |
last post by:
Hi, noticed high activity on this newsgroup as the last few posts I have made
have not received a response. Anyhow I noticed that with a .NET web
application when the webform opens if the user...
|
by: androoo |
last post by:
Hi
I am learing how to use the grid in asp.net.
Im trying to replace the button columns with nice friendly images.
So :
<asp:ButtonColumn Text="Delete"...
|
by: Neal |
last post by:
Bit puzzling,
This Style works in some IE browsers (all are at least 5.50) , some not
however.
ie...
|
by: Patti |
last post by:
I am building an application using VB.NET 1.1 and I have an issue with
Font properties in my Radio Button Lists and Check Box Lists. My issue
is that the Font Names and Font Size for these...
|
by: comp.lang.php |
last post by:
Consider my code:
/**
* Set the TTF array property $ttfArray
*
* @access private
* @see actual_path
*/
function &setTTFArray() { // STATIC VOID METHOD
|
by: dengel |
last post by:
I'm a classic ASP/VbScript user, transitioning to c# and .NET. I'm
making a little PW change utility which does this:
1. User inputs an email address/username (into a textbox)
2. User inputs...
|
by: Roedy Green |
last post by:
Is there a shortcut way to define the default font family (and
characteristics) to be applied to all styles?
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |