[Solved] Creating a list of fonts

Discuss setup / installation issues - Add a spell checker, Language pack?
Post Reply
adityavpratap
Posts: 12
Joined: Fri Sep 12, 2008 4:56 pm

[Solved] Creating a list of fonts

Post by adityavpratap »

Hi!

I have been using OpenOffice.org on Linux for some time now. I have found it very useful.

I need to create a list of available fonts. Suppose there are x number of fonts available, I want to create a document containing a line of text displayed in all the available fonts. The manual way of doing it is too tedious, so is there any way of creating such a document automatically?

Thanking in advance,

Aditya Pratap V.
Last edited by Hagar Delest on Sun Dec 20, 2009 1:35 pm, edited 1 time in total.
Reason: tagged [Solved].
Aditya Pratap V.
OpenOffice.org 3.1 + Ubuntu
User avatar
RoryOF
Moderator
Posts: 34610
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: creating a list of fonts

Post by RoryOF »

http://opcion.sourceforge.net/ might do what you require.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
Robert Tucker
Volunteer
Posts: 1250
Joined: Mon Oct 08, 2007 1:34 am
Location: Manchester UK

Re: creating a list of fonts

Post by Robert Tucker »

For all the fonts available on your Linux system:

Code: Select all

$ (echo '<html><body>' && (fc-list | sed 's/\(.*\):.*/<font face="\1">\1<\/font><br>/') && echo '</body></html>') > fonts.html
$ firefox fonts.hml
http://www.codealpha.net/66/print-insta ... each-font/

Otherwise you might have a look at using Python (don't know if Basic will do the same thing) with a list of fonts you have created from the directories you know OpenOffice can access and edited into the form:

Code: Select all

cursor.setPropertyValue("CharFontName", "Arial")
cursor.setPropertyValue("CharWeight", 150)
document.Text.insertString(cursor, "\n\nThis is bold Arial."
cursor.setPropertyValue("CharFontName", "Times New Roman")
cursor.setPropertyValue("CharWeight", 150)
document.Text.insertString(cursor, "\n\nTimes New Roman."
etc
etc
http://www.devshed.com/c/a/Python/Pytho ... ficeorg/2/
LibreOffice 7.x.x on Arch and Fedora.
adityavpratap
Posts: 12
Joined: Fri Sep 12, 2008 4:56 pm

Re: creating a list of fonts

Post by adityavpratap »

Robert Tucker wrote:For all the fonts available on your Linux system:

Code: Select all

$ (echo '<html><body>' && (fc-list | sed 's/\(.*\):.*/<font face="\1">\1<\/font><br>/') && echo '</body></html>') > fonts.html
$ firefox fonts.hml
http://www.codealpha.net/66/print-insta ... each-font/
Thanks a lot! So it creates a html file that can be opened in a web-browser. That's convenient! I can then copy all the text from the browser into OOo writer of directly convert the webpage to pdf using the Print to file option. Thanks a lot once again.
Aditya Pratap V.
OpenOffice.org 3.1 + Ubuntu
User avatar
Robert Tucker
Volunteer
Posts: 1250
Joined: Mon Oct 08, 2007 1:34 am
Location: Manchester UK

Re: creating a list of fonts

Post by Robert Tucker »

adityavpratap wrote:Thanks a lot! So it creates a html file that can be opened in a web-browser. That's convenient! I can then copy all the text from the browser into OOo writer
Yes, but I think you will find it's more of a list of all the fonts on your system – some/many may not be available to OpenOffice, particularly some of the system fonts.
LibreOffice 7.x.x on Arch and Fedora.
adityavpratap
Posts: 12
Joined: Fri Sep 12, 2008 4:56 pm

Re: [Solved] Creating a list of fonts

Post by adityavpratap »

Oh!
Then is there a way to do it from within OOo?
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Solved] Creating a list of fonts

Post by acknak »

I've used this macro from Andrew Pitonyak: http://www.pitonyak.org/AndrewFontMacro.odt

It generates a Writer document with a sample of every font available to OOo.
AOO4/LO5 • Linux • Fedora 23
Star_Gazer
Posts: 12
Joined: Tue Apr 13, 2010 3:06 am

Re: [Solved] Creating a list of fonts

Post by Star_Gazer »

acknak wrote:I've used this macro from Andrew Pitonyak: http://www.pitonyak.org/AndrewFontMacro.odt

It generates a Writer document with a sample of every font available to OOo.
I downloaded the AndrewFontMacro.odt file, and cannot get the Macro to run. How does one get that macro to work?
I would like to have the fonts listed in their original styles - the html method provided above just does the 'regular' styles and has a lot of duplicates that looks the same, respectfully.

Regards,
Clifton
LibreOffice.org 3.3.* | openSUSE 11.4 KDE
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Solved] Creating a list of fonts

Post by acknak »

The font list macro in that document works fine for me.

You just have to open the document, scroll down to the section you want (2: "Formatted font summary") and click on the button to run the macro.

Note: OOo's normal security settings should prevent you from running macros. You will need to change the settings under Tools > Options > OO.org > Security > Macro Security to allow macros to run.
AOO4/LO5 • Linux • Fedora 23
Star_Gazer
Posts: 12
Joined: Tue Apr 13, 2010 3:06 am

Re: [Solved] Creating a list of fonts

Post by Star_Gazer »

acknak wrote:The font list macro in that document works fine for me.

You just have to open the document, scroll down to the section you want (2: "Formatted font summary") and click on the button to run the macro.

Note: OOo's normal security settings should prevent you from running macros. You will need to change the settings under Tools > Options > OO.org > Security > Macro Security to allow macros to run.
Yes ... Yes! All is good now, and now I have got my listing. Just the Regular ones too, without all the other ones of the family (Italic, Bold, etc.) just as I prefer.

A many thanks! :super:

Yesterday, I could not get that button to work.

Thanks,
Clifton
LibreOffice.org 3.3.* | openSUSE 11.4 KDE
Post Reply