2 classvar defaultSansFace, defaultSerifFace, defaultMonoFace;
3 var <>name, <size, <>bold, <>italic, <hasPointSize=false;
4 /* ----------------- class -------------------*/
6 *implementsClass {^'Font'}
12 *new { arg name, size, bold = false, italic = false, usePointSize = false;
13 ^super.newCopyArgs( name, size, bold, italic, usePointSize );
20 *antiAliasing_ { arg flag;
23 *smoothing_ { arg flag;
42 *monospace {|size, bold = false, italic = false, usePointSize = false|
43 ^this.new(this.defaultMonoFace, size, bold, italic, usePointSize)
46 *serif {|size, bold = false, italic = false, usePointSize = false|
47 ^this.new(this.defaultSerifFace, size, bold, italic, usePointSize)
50 *sansSerif {|size, bold = false, italic = false, usePointSize = false|
51 ^this.new(this.defaultSansFace, size, bold, italic, usePointSize)
54 /* ------------------instance------------------*/
60 ^this.class.new( name, size, true, italic );
63 size_ { arg pixelSize; this.pixelSize_( pixelSize ); }
65 pixelSize_ { arg pixelSize;
70 pointSize_ { arg pointSize;
75 pixelSize { ^( if(hasPointSize){nil}{size} ) }
77 pointSize { ^( if(hasPointSize){size}{nil} ) }
79 // support Qt GUI in combination with CocoaDocument
82 cocoa = GUI.get(\cocoa);
84 scfont = cocoa.font.new(name, size);
85 if(bold){scfont = scfont.boldVariant};
92 /* ------------------ private -----------------*/