Glyph cursors
Glyph cursors are created by using a character from an application-specified font as a cursor. To create a glyph cursor, the application must have loaded a CgFont. Then a cursor object is created by sending the createGlyphCursor:sourceChar:maskChar: or createGlyphCursor:sourceChar:maskChar:foregroundColor:backgroundColor: message to the CgFont object (the "source font"). In the following example, the same font and character are used for the mask font and the mask character. The following code creates and displays the @ sign as a cursor.
| window font cursor |
window := self shell window.
"Create the cursor."
font := window display loadFont: '8x13'.
cursor := font
createGlyphCursor: font
sourceChar: $@ asInteger
maskChar: $@ asInteger.
font unloadFont.
"Display the cursor."
window defineCursor: cursor.
(Delay forSeconds: 5) wait.
window undefineCursor.
cursor freeCursor
Last modified date: 04/18/2020