| ||
Introducing SharpPlot Your First Chart Recent Updates Sample Charts Tutorials General Tutorials Chart Tutorials SharpPlot Class Properties Structures Enumerations Style examples Glossaries Active Charts VectorMath Class DBUtil Class Get SharpPlot Download SharpPlot Buying SharpPlot SharpPlot Support Upgrading from GraPL Release notes |
Reference > Methods > DefineFont Method SharpPlot.DefineFont MethodAdd a short code for a complex font definition. Examplesp.DefineFont("AS","Arial,sans","filter:url(#MyShadow);opacity:0.8"); Overloads
Creating a stylesheetThis method may be used simply to define a ‘house style’ of fonts to save possible errors in typing the full name, and to make future change much simpler. You may give each font face a two-letter code, for example: sp.DefineFont("VN","Verdana,sans"); From now on, you can use any of the four short codes ‘VN’ ‘VNB’ ‘VNI’ or ‘VNBI’ to get the four variants of this basic font. To have your Captions in Verdana,Italic, (at default size) you simply use: sp.SetCaptionFont("VNI",Color.Teal); If you are giving a long string of alternative font names for use as browser fall-backs, this clearly saves a good deal of typing. Longer abbreviations (up to 4 characters) will be accepted but may not be suffixed to make the variants. Adding extra CSS detailsSharpPlot allows you to insert any extra CSS properties you want after the font name. These are passed on to charts rendered as SVG or VML, and may be used for various special effects. They are ignored in images and PDF rendering. sp.DefineFont("VN","Verdana,sans","opacity:0.8"); You can set any standard font property here, for example letter-spacing to open out heading text slightly. Setting up PostScript equivalentsIf you are generating an EPS document, you may need to map your screen font to a PostScript font known on the printer. sp.DefineFont("VN","Verdana,sans","","Univers"); Check with the repro house to be sure you get the names exactly correct here! See also ... |