mac-samples/CoreTextArcMonoMac
conceptdev 3c0a72ae06 improving the readme experience 2019-07-23 09:36:24 -07:00
..
Screenshots Added some screenshots 2012-12-11 17:39:08 -05:00
AppDelegate.cs [CoreTextArcMonoMac] Code formatting 2015-03-04 02:42:07 +03:00
CoreTextArcMonoMac.csproj Set HttpClientHandler to NSUrlSessionHandler for all samples 2018-05-02 13:22:24 -06:00
CoreTextArcMonoMac.sln fix makefile 2011-02-07 11:40:50 -05:00
CoreTextArcView.cs [CoreTextArcMonoMac] Code formatting 2015-03-04 02:42:07 +03:00
Info.plist Updated min deployment version (#113) 2018-11-15 03:52:17 -05:00
LICENSE.txt [CoreTextArcMonoMac] Update license 2016-02-22 01:52:51 -03:00
Main.cs [CoreTextArcMonoMac] Code formatting 2015-03-04 02:42:07 +03:00
MainMenu.xib fix makefile 2011-02-07 11:40:50 -05:00
MainMenu.xib.designer.cs Migrated Core Animation,CFNetwork,CoreTextArcMonoMac to uniifed 2014-12-02 12:11:59 -05:00
MainWindow.cs fix makefile 2011-02-07 11:40:50 -05:00
MainWindow.xib fix makefile 2011-02-07 11:40:50 -05:00
MainWindow.xib.designer.cs fix makefile 2011-02-07 11:40:50 -05:00
MainWindowController.cs fix makefile 2011-02-07 11:40:50 -05:00
Metadata.xml Add brief description tag to metadata.xml 2015-04-16 15:35:20 -04:00
MyDocument.cs [CoreTextArcMonoMac] Code formatting 2015-03-04 02:42:07 +03:00
MyDocument.xib [CoreTextArcMonoMac] Remove resize button from window toolbar. Fix for #33565 2015-10-16 15:00:42 -03:00
MyDocument.xib.designer.cs Migrated Core Animation,CFNetwork,CoreTextArcMonoMac to uniifed 2014-12-02 12:11:59 -05:00
ReadMe.md improving the readme experience 2019-07-23 09:36:24 -07:00

ReadMe.md

name description page_type languages products urlFragment
Xamarin.Mac - CoreTextArcMonoMac Illustrates how to use CoreText to draw text along an arc in a Xamarin.Mac application. The main drawing functionality demonstrated in this... sample
csharp
xamarin
coretextarcmonomac

CoreTextArcMonoMac

Illustrates how to use CoreText to draw text along an arc in a Xamarin.Mac application.

The main drawing functionality demonstrated in this application is implemented in a custom NSView called CoreTextArcView.
All of the interesting functionality in that view is encapsulated in the -drawRect: method in the CoreTextArcView.cs file.
There, CoreText is used to layout and draw glyphs along a curve.

CoreTextArcMonoMac application screenshot

NSFontPanel

This sample also makes use of the NSFontPanel to allow user configuration of the text being displayed in the custom view.
This functionality can be found in the file MyDocument.cs. Key points to make note of in that file are:

  1. The font panel is synchronized with the current font settings for the custom view in the -windowDidBecomeKey: method. The Font Panel is a shared resource that stays on screen and calls methods on the first responder to communicate changes in the font selection. By placing the synchronization code inside of the -windowDidBecomeKey: method, the application is able to make sure the font panel settings are accurately reflected for the state of the document whenever the it becomes the first responder.

  2. The -changeFont: method on the MyDocument class is called by the font panel whenever the user selects and new font setting. This method receives the new font settings and changes the font settings for the custom view.

  3. The methods -toggleBold: and -toggleItalic: are called in response to user clicks in the italic and bold checkboxes. In these methods, the respective font attributes are changed and then the current settings are synchronized to the font pane and to the custom view.

Running the sample

  • Build and run this sample.
  • When launched, the application will display a string drawn along an curve.
  • Click in the checkboxes in wthe window to change some font settings.
  • Choose the "Show Fonts" menu item from the "Format" menu to open the font panel so you can change additional font settings.

License

Xamarin port changes are released under the MIT license