[jmsl] Maestro music font and Java

jmsl at music.columbia.edu jmsl at music.columbia.edu
Thu Feb 15 12:35:18 EST 2007


Looks like you're right.
And finding an example that displays a unicode font in Java is meeting 
with no little resistance...
I'll post a message if I find something out.
Thanks
Nick


jmsl at music.columbia.edu wrote:
> Almost sounds like a Unicode vs Ascii kind of problem.
>
> --rbt
>
>   
>> -----Original Message-----
>> From: jmsl-bounces at music.columbia.edu
>> [mailto:jmsl-bounces at music.columbia.edu]On Behalf Of
>> jmsl at music.columbia.edu
>> Sent: Tuesday, February 13, 2007 12:58 PM
>> To: jmsl at music.columbia.edu
>> Subject: Re: [jmsl] Maestro music font and Java
>>
>>
>> Thanks Daniel, for inspecting the font. This may indeed be a clue. 
>> This issue may fall into the "whose problem is this?" category... may 
>> have to haunt some Java forums for this.
>> Thanks
>> Nick Didkovsky
>>
>> jmsl at music.columbia.edu wrote:
>>     
>>> Well, I ain't no font xpert but, in comparing any of the 
>>>       
>> Finale fonts with 
>>     
>>> regular text-based fonts via the Start/Programs/Accessories/System 
>>> Tools/Character Map in XP, it looks like the Finale fonts 
>>>       
>> use a hex code 
>>     
>>> (they all appear correctly in that app), whereas the 
>>>       
>> regular fonts use a 
>>     
>>> 'U+xxxx' type format, with a lengthy description of every single 
>>> character(!)   Maybe that's a clue?
>>>
>>> Cheers
>>> dp
>>>
>>> Daniel Palkowski
>>> Multimedia Producer, Audio Specialist
>>> Ernst & Young, NCS Multimedia
>>> 5 Times Sq., 06-092
>>> New York, NY 10036
>>> 212-773-2157
>>>
>>>
>>>
>>> jmsl at music.columbia.edu 
>>> Sent by: jmsl-bounces at music.columbia.edu
>>> 02/13/2007 10:45 AM
>>> Please respond to
>>> jmsl at music.columbia.edu
>>>
>>>
>>> To
>>> jmsl at music.columbia.edu
>>> cc
>>>
>>> Subject
>>> [jmsl] Maestro music font and Java
>>>
>>>
>>>
>>>
>>>
>>>
>>> Hello JMSL users,
>>>
>>> I am considering (but by no means committing to) the idea 
>>>       
>> of optionally 
>>     
>>> supporting music fonts in JMSL Score. So I ran a simple 
>>>       
>> test that loads 
>>     
>>> the Maestro music font and renders some characters to a 
>>>       
>> JPanel. Didn't 
>>     
>>> take long to run into a snag:
>>>
>>> My example works fine on two OS X machines; a JFrame opens 
>>>       
>> and music 
>>     
>>> fonts are displayed in it. 
>>> It does NOT work on either of two Windows XP machines I 
>>>       
>> have tried it 
>>     
>>> on. Under Windows, it renders empty rectangles instead of 
>>>       
>> the music font 
>>     
>>> characters.
>>>
>>> As a sanity check (ie to make sure the font is installed and can be 
>>> found by Java), my code enumerates through all fonts that the 
>>> GraphicsEnvironment reports it can access, and when the font name 
>>> matches "Maestro", it picks up that font, else reports an 
>>>       
>> error. Still, 
>>     
>>> under Windows, even after successfully reporting a matching 
>>>       
>> font name, 
>>     
>>> the example shows rectangles.  OSX shows the expected music 
>>>       
>> characters.
>>     
>>> If someone who has an interest in this issue can try this 
>>>       
>> under Windows, 
>>     
>>> or corroborate that it works on the Mac I'd appreciate it 
>>>       
>> (I am more 
>>     
>>> interested in the Windows problem than the OSX success, as 
>>>       
>> Mike Winter 
>>     
>>> has already verified that it works on the Mac, and uses the 
>>>       
>> Maestro font 
>>     
>>> successfully in his own Java+OSX software). And if someone 
>>>       
>> can provide a 
>>     
>>> workaround/solution under Windows, I'd appreciate that too!
>>>
>>> Note that I downloaded the award-winning Java-based Opcion 
>>>       
>> Font Viewer 
>>     
>>> (http://sourceforge.net/projects/opcion/ ) and tried 
>>>       
>> viewing the Maestro 
>>     
>>> font with it, and even Opcion shows rectangles instead of 
>>>       
>> the Maestro 
>>     
>>> font. So something seems very wrong at a level that is 
>>>       
>> beyond mere Java 
>>     
>>> source code. Note that opening the Maestro font in MS Word 
>>>       
>> under Windows 
>>     
>>> renders music characters as expected, so it's not as though 
>>>       
>> Maestro is 
>>     
>>> broken under Windows (and of course Finale loads and shows Maestro 
>>> symbols just fine on my Windows machines)
>>>
>>> Source pasted below, may need some minor reformatting if your email 
>>> client wraps the lines funnily.
>>>
>>> You get get the Maestro font for free by downloading Finale 
>>>       
>> Notepad from 
>>     
>>> http://www.finalemusic.com/notepad/
>>>
>>> Thanks,
>>> Nick Didkovsky
>>>
>>>
>>>
>>>
>>> /*
>>>  * Created on Feb 12, 2007 by Nick
>>>  *
>>>  */
>>> package com.punosmusic;
>>>
>>> import java.awt.*;
>>> import java.io.IOException;
>>>
>>> import javax.swing.JFrame;
>>> import javax.swing.JPanel;
>>>
>>> /**
>>>  * Displays text drawn in the Maestro music font in a 
>>>       
>> JPanel.  Works on 
>>     
>>> Mac not on Windows. Wonder why.
>>>  *
>>>  * You get get the Maestro font for free by downloading 
>>>       
>> Finale Notepad 
>>     
>>> from http://www.finalemusic.com/notepad/
>>>  *
>>>  * @author Nick Didkovsky, (c) 2007 Nick Didkovsky
>>>  *
>>>  */
>>> public class FontTest extends JPanel {
>>>
>>>     private Font maestroFont;
>>>     private String charsToPrint = 
>>> "=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
>>>
>>>     public void buildFontByLookingItUp(String fontName) throws 
>>> FontFormatException, IOException {
>>>         GraphicsEnvironment ge = 
>>> GraphicsEnvironment.getLocalGraphicsEnvironment();
>>>         System.out.println("FONTS");
>>>         Font[] fonts = ge.getAllFonts();
>>>         for (int i = 0; i < fonts.length; i++) {
>>>             System.out.println(fonts[i].getFontName());
>>>             if (fontName.equalsIgnoreCase(fonts[i].getFontName())) {
>>>                 maestroFont = fonts[i].deriveFont(Font.PLAIN, 12f);
>>>                 System.out.println("Found your font: " + 
>>>       
>> fontName + "!");
>>     
>>>                 break;
>>>             }
>>>         }
>>>     }
>>>
>>>     public void buildFontExplicitely(String fontName) throws 
>>> FontFormatException, IOException {
>>>         maestroFont = new Font(fontName, Font.PLAIN, 12);
>>>     }
>>>
>>>     public void paintComponent(Graphics g) {
>>>         super.paintComponent(g);
>>>         if (maestroFont != null) {
>>>             g.setFont(maestroFont);
>>>
>>>             for (int i = 0; i < charsToPrint.length(); i++) {
>>>                 int x = i * 15;
>>>                 int y = 30 + (int) (Math.random() * 20);
>>>                 g.drawString(charsToPrint.substring(i, i + 
>>>       
>> 1), x, y);
>>     
>>>             }
>>>         } else {
>>>             String err = "No Maestro font found";
>>>             g.drawString(err, 20, 20);
>>>             System.err.println(err);
>>>         }
>>>
>>>     }
>>>
>>>     public static void main(String[] args) {
>>>         JFrame jf = new JFrame("Maestro font test, works on 
>>>       
>> Mac, not on 
>>     
>>> Windows");
>>>         FontTest ft = new FontTest();
>>>         try {
>>>             String fontName = "Maestro";
>>>             ft.buildFontByLookingItUp(fontName);
>>>             // ft.buildFontExplicitely(fontName);
>>>         } catch (FontFormatException e) {
>>>             e.printStackTrace();
>>>         } catch (IOException e) {
>>>             e.printStackTrace();
>>>         }
>>>         ft.setPreferredSize(new Dimension(1024, 60));
>>>         jf.getContentPane().add(ft);
>>>         jf.pack();
>>>         jf.setVisible(true);
>>>     }
>>> }
>>>
>>> _______________________________________________
>>> jmsl mailing list
>>> jmsl at music.columbia.edu
>>> http://music.columbia.edu/mailman/listinfo/jmsl
>>>
>>>  
>>>
>>> Any U.S. tax advice contained in the body of this e-mail 
>>>       
>> was not intended or written to be used, and cannot be used, 
>> by the recipient for the purpose of avoiding penalties that 
>> may be imposed under the Internal Revenue Code or applicable 
>> state or local tax law provisions.
>>     
>> ______________________________________________________________
>> __________
>>     
>>> The information contained in this message may be privileged 
>>>       
>> and confidential and protected from disclosure.  If the 
>> reader of this message is not the intended recipient, or an 
>> employee or agent responsible for delivering this message to 
>> the intended recipient, you are hereby notified that any 
>> dissemination, distribution or copying of this communication 
>> is strictly prohibited. If you have received this 
>> communication in error, please notify us immediately by 
>> replying to the message and deleting it from your computer.  
>>     
>>> Notice required by law:  This e-mail may constitute an 
>>>       
>> advertisement or solicitation under U.S. law, if its primary 
>> purpose is to advertise or promote a commercial product or 
>> service.   You may choose not to receive advertising and 
>> promotional messages from Ernst & Young LLP (except for Ernst 
>> & Young Online and the ey.com website, which track e-mail 
>> preferences through a separate process) at this e-mail 
>> address by forwarding this message to no-more-mail at ey.com.  
>> If you do so, the sender of this message will be notified 
>> promptly. Our principal postal address is 5 Times Square, New 
>> York, NY 10036. Thank you.  Ernst & Young LLP
>>     
>>> _______________________________________________
>>> jmsl mailing list
>>> jmsl at music.columbia.edu
>>> http://music.columbia.edu/mailman/listinfo/jmsl
>>>   
>>>       
>> _______________________________________________
>> jmsl mailing list
>> jmsl at music.columbia.edu
>> http://music.columbia.edu/mailman/listinfo/jmsl
>>     
> _______________________________________________
> jmsl mailing list
> jmsl at music.columbia.edu
> http://music.columbia.edu/mailman/listinfo/jmsl
>   


More information about the jmsl mailing list