apply font folder
Moderators: SDS, support, admin
apply font folder
I am using to add the CADViewerControl to the program.
I want to open a drawing file by applying a shx font folder.
I used the code does not apply.
I would like to know how to apply the shx&ttf folder.
I want to open a drawing file by applying a shx font folder.
Code: Select all
cadViewerControl1.SHXForm.AddPath("E:\\test");
CADConst.DefaultSHXParameters.UseSHXFonts = true;
cadViewerControl1.LoadFile("E:\\test\\test1.dwg");
I would like to know how to apply the shx&ttf folder.
Re: apply font folder
Hello,
This code will be enough to apply a folder with SHX fonts:
CADConst.DefaultSHXParameters.UseSHXFonts is set to true by default, so you may omit this line:
TTF fonts are read only from the system folder c:\Windows\Fonts\. To override the usage of the SHX fonts and enable the TTF fonts, you may use the following code:
Mikhail
This code will be enough to apply a folder with SHX fonts:
Code: Select all
cadViewerControl1.SHXForm.AddPath("E:\\test");
Code: Select all
CADConst.DefaultSHXParameters.UseSHXFonts = true;
Code: Select all
cadViewerControl1.SHXForm.AddPath("E:\\test");
CADConst.DefaultSHXParameters.UseSHXFonts = false;
CADConst.DefaultSHXParameters.UseTTFFonts = true;
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: apply font folder
Please tell us what is wrong.
I have attached sample souece, drawing file, shx font.
Code: Select all
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using CADImport;
namespace TEST
{
public partial class Form1 : Form
{
String _sampleDir;
String _sampleFile;
public Form1()
{
InitializeComponent();
DirectoryInfo di = new DirectoryInfo(Application.StartupPath);
_sampleDir = di.Parent.FullName + "\\sample";
_sampleFile = _sampleDir + "\\sample.dwg";
}
// shx fonts folder
private void button1_Click(object sender, EventArgs e)
{
cadViewerControl1.SHXForm.AddPath(_sampleDir);
cadViewerControl1.AddSHXPaths();
}
// use shxfont
private void button2_Click(object sender, EventArgs e)
{
CADConst.DefaultSHXParameters.UseSHXFonts = true;
CADConst.DefaultSHXParameters.UseTTFFonts = false;
CADConst.DefaultSHXParameters.UseMultyTTFFonts = true;
cadViewerControl1.ReOpen();
}
// sample file open
private void button3_Click(object sender, EventArgs e)
{
cadViewerControl1.LoadFile(_sampleFile);
}
}
}
- Attachments
-
- TEST.zip
- (72.29 KiB) Downloaded 1160 times
Re: apply font folder
Hello,
Thank you for the test project.
Your code is correct, the problem is in a missing Big Font file @extfont2.shx which is used by the text style. Big Fonts are intended for displaying non-ASCII characters in Asian texts.
The file @extfont2.shx comes with CAD .NET library and can be found in the \CAD .NET 11\shx\ folder. You should copy this file to the \sample folder (or any other SHX folder added from your code).
Mikhail
Thank you for the test project.
Your code is correct, the problem is in a missing Big Font file @extfont2.shx which is used by the text style. Big Fonts are intended for displaying non-ASCII characters in Asian texts.
The file @extfont2.shx comes with CAD .NET library and can be found in the \CAD .NET 11\shx\ folder. You should copy this file to the \sample folder (or any other SHX folder added from your code).
Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support