Your code looks pretty good.  What is the trouble?  Do you have
something like the following?


      fontStream = new FileInputStream(file);
      font = Font.createFont(Font.TRUETYPE_FONT,fontStream);
      font = font.deriveFont(attributes);

where attributes sets the logical and family font names?

On 5/6/05, Daniel Watrous <[EMAIL PROTECTED]> wrote:
> Hello,
> 
> I am writing an application which needs to load font files.  The font
> files are deployed with other classes on the server (i.e. under the
> WEB-INF/classes directory).   Currently I have the reference built in
> like this
> 
>     //private static final String pathToWebapp =
> "/var/tomcat/jakarta-tomcat-5.0.25/webapps/words2walls";
>     private static final String pathToWebapp = "C:\\Program
> Files\\Apache Software Foundation\\Tomcat 5.0\\webapps\\words2walls";
>     //private static final String pathToPackage =
> "/WEB-INF/classes/com/words2walls/fonts/";
>     private static final String pathToPackage =
> "\\WEB-INF\\classes\\com\\words2walls\\fonts\\";
> 
> and I use the above variables as follows:
> 
>             File fontFile = new File (pathToWebapp+pathToPackage+filename);
>             FileInputStream fis = new FileInputStream(fontFile);
>             font = Font.createFont(Font.TRUETYPE_FONT, fis);
> 
> I tried unsuccessfully to use the class loader, but this might just be
> my ineptitude.  Can someone suggest a way for me to reference these
> font files dynamically so that I can more easily deploy it in
> different locations?  Thanks!
> 
> Daniel
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to