The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: shankle on September 15, 2007, 09:08:05 PM

Title: treble clef
Post by: shankle on September 15, 2007, 09:08:05 PM
Wrote a program many years ago to put a treble clef on a staff of about 1/2 inch in height
with the staff lines behind it. My art work is deplorable. But that's not the only problem.
It was for a printer of the old style and now the old treble clef is way to small on the
new printers. What I need is a treble clef that is scalable for the next inovation of printers.

IN the old program I used plotting paper and converted that to pixels and a
routine that drew the treble clef with a variable y coordinate. There has to
be a better way.
I don't see a way of doing this with MS Paint.
Thanks for any help...
Title: Re: treble clef
Post by: hutch-- on September 15, 2007, 10:16:57 PM
Jack,

See if you can find a true type front that has the character in it.
Title: Re: treble clef
Post by: Tedd on September 16, 2007, 03:11:30 PM
Found this rotting on my hard-drive :wink
(Treble-clef is ampersand '&')


[attachment deleted by admin]
Title: Re: treble clef
Post by: shankle on September 16, 2007, 07:31:05 PM
Thanks for helping guys.
Look for musical true type fonts with no luck.

Downloaded the zip file for the musical symbols and couldn't find a treble clef in it.
If I wanted to use another symbol in the Musical font how would I do it?
The following code just put an "&" in the print line.

MS              db   'MusicalSymbols',0
tcsign           db   '&',0
         
         invoke  CreateFont, 170,100,0,0, FW_LIGHT, FALSE,FALSE,FALSE, \
             DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS, \
             PROOF_QUALITY, FF_DONTCARE, ADDR MS             
         
         invoke TextOut, hdcPrn, 2550, 340, ADDR tcsign, 1     ; Treble Clef test
Obviously I am missing something.

Title: Re: treble clef
Post by: Jimg on September 16, 2007, 08:10:10 PM
Also look here - http://www.icogitate.com/~ergosum/fonts/music-fonts2.htm
Title: Re: treble clef
Post by: Tedd on September 17, 2007, 11:11:58 AM
Make sure the font is installed correctly -- copy it directly in to "C:\WINDOWS\Fonts\"

The attachment shows most of the symbols (with the '&' coming out as the treble-clef.)


[attachment deleted by admin]
Title: Re: treble clef
Post by: Rockoon on September 17, 2007, 11:26:37 AM
It is usualy a good idea to check the return code of API functions..

Both CreateFont() and TextOut() return 0 when they fail

Additionally, although I havent tested it, I believe that the font must be selected into the device context that you will be rendering text with via SelectObject()

Also remember to clean up..

SelectObject()'s return value is the previous objects handle (of the same type) selected into the DC and you should save this value and restore this value when you are done (with another SelectObject call) and finally destroy the font object you created with CreateFont()

In psuedo terms, something like:

hfont = CreateFont(...)
If (0 != hfont)
..hfont = SelectObject(hdc, hfont)
..If (0 = TextOut(...)) then an error printing the text
..DeleteObject(SelectObject(hdc, hfont))
Else
..an error creating the font