News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

treble clef

Started by shankle, September 15, 2007, 09:08:05 PM

Previous topic - Next topic

shankle

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...
The greatest crime in my country is our Congress

hutch--

Jack,

See if you can find a true type front that has the character in it.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Tedd

Found this rotting on my hard-drive :wink
(Treble-clef is ampersand '&')


[attachment deleted by admin]
No snowflake in an avalanche feels responsible.

shankle

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.

The greatest crime in my country is our Congress

Jimg


Tedd

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]
No snowflake in an avalanche feels responsible.

Rockoon

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

When C++ compilers can be coerced to emit rcl and rcr, I *might* consider using one.