Jump to content

XSLT formatting - fonts for RTF


chrisk1
 Share

This topic is 5592 days old. Please don't post here. Open a new topic instead.

Recommended Posts

At the end of my rope here

In an XSLT style sheet to format text with a specific font when creating an RTF document-

Using this language to create a formatting command:

RTFcodeFontname ">

and as the formatting command:

&RTFcodeFontname;

...what would I use as the "RTFcode" for an RTF formatting code?

I've been able to use this language structure to format everything from size to line spacing to color, but I cannot find an example where it is dictated how to format text as a specific font.

Thanks!

Link to comment
Share on other sites

Hi, thanks for your response. I know this isn't a specifically-FM related topic but it's the only place I thought I'd be able to get a decent answer, so especially thanks.

I have been able to peek into some actual RTF code and have seen the font table structure in the language specification, so what you posted did look familiar but I don't think it helps me. If you look into the file I'm posting you can see that the section near the top declares entities to use as elements of a style sheet, and that a form of tag is created which is used throughout the document to instruct and RTF-compatable editor to display text as the format tags instruct it to. I am able to use this method to format all sorts of character attributes (bold, size, etc.) however specifying a specific font eludes me. I would assume that specifying a specific font would be possible, since if I create a document in Text Editor and specify a word to be "Garamond" it displays in that font, even when opened in Word.

I have scoured the RTF laguage specification up and down several times and have not been able to find a solution, nor have I been able to find a file that would be a good example of what I'm trying to accomplish font-wise.

The file I am posting is a modified version of the "RTF with XSLT" example in the XSLT library on FileMaker's site found at http://www.filemaker.com/products/technologies/xslt_library.html

I've been using Dreamweaver's code view to edit the files as the tags are easier to view.

Please excuse the excess of tabs and general untidiness

Thanks in advance for any help anyone would be able to give me. Like I said, I truly am at the end of the rope here.

xsltExample.txt

Link to comment
Share on other sites

Try to add the following code:

{rtf1 [color:red]deff0 {fonttbl {f0 Garamond;}} titlepg

or whatever font you're using. This will make Garamond the default font.

If you need more fonts, add more {f[color:green]X FontName;} in fonttbl, where [color:green]X is a unique number and define matching entities for them

f0 ">

f1 ">

Use these entities to switch fonts.

You may also be interested in EZxslt. From their site:

"Quickly and easily use XML to create formatted Microsoft Word documents using FileMaker Pro 6, FileMaker Pro 7 and FileMaker Pro 8 based data!"

http://www.chapsoft.com/ezxslt/index.html

Link to comment
Share on other sites

Genius, my friend, pure genius.

Looking back at the specification documentation this totally makes sense now. This actually answers many questions I know I would have had to ask in the future but thanks to this I won't have to. Man, thanks so much! I've been using XSLT to fill forms in PDFs, but since saving was removed from Acrobat Reader I had to scrap it and try this method. So I've actually only been exposed to the real inner-workings of XSLT for about a week and a half. Good example of how something so complicated can work so simply.

Thank you so much again!

Link to comment
Share on other sites

This topic is 5592 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.