Font path
![]() 1/5/2015 10:43 AM
|
---|
Hi BUT So I guess my question is how to set the font file location on runtime? Dror |
![]() 1/5/2015 12:23 PM
|
---|
Hi Dror, TT fonts can only be accessed if they are installed in your Windows system during conversion. SHX fonts are always looked for in the directory of the DWG/DXF file and in the path of the executable, or somewhere in a global SHX font lookup path collection. You can modify and access this collection via static methods and properties C# Code: // add directories where SHX fonts are localized DxfModel.AddShxLookupDirectories() // clear these directories DxfModel.ClearShxLookupDirectories() // access the current value DxfModel.GlobalShxLookupDirectories Changed paths will be used in the next load, already loaded models are not influenced. You can define which font to use if a font defined in a file is not found via two static properties C# Code: // Fallback for SHX fonts DxfModel.FallbackShxFont // Fallback for TT fonts DxfModel.FallbackTrueTypeFont Changed fallbacks will be used in the next load, already loaded models are not influenced. If a fallback is not found the last resort is always Arial TTF, which should be available on a sane Windows machine, or anything the Windows font access routines give back as a default if it is missing. When converting to PDF you can embed TT fonts (if their licenses allow to do so) by setting both the GraphicsConfig.TryDrawingTextAsText property (of the GraphicsContext used in the PdfExporter) and the PdfExporter.EmbedFonts property to true. SHX fonts are never embedded as PDF cannot handle this kind of font, so SHX based texts for which the SHX font could be found during conversion are always included as graphics. You can include all texts as graphics by setting GraphicsConfig.TryDrawingTextAsText to false, which guarantees that the PDF content is as close as possible to what you see using screen display via CadLib. If EmbedFonts is false or a font does not allow to be embedded only a reference to the font is stored in the PDF, so display depends on whether the font is installed on the viewing system or not. - Rammi |