Page 1 of 1
apply font folder
Posted: 10 Oct 2016, 11:29
by 윤영철
I am using to add the CADViewerControl to the program.
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 used the code does not apply.
I would like to know how to apply the shx&ttf folder.
Re: apply font folder
Posted: 18 Oct 2016, 19:39
by support
Hello,
This code will be enough to apply a folder with SHX fonts:
Code: Select all
cadViewerControl1.SHXForm.AddPath("E:\\test");
CADConst.DefaultSHXParameters.UseSHXFonts is set to
true by default, so you may omit this line:
Code: Select all
CADConst.DefaultSHXParameters.UseSHXFonts = true;
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:
Code: Select all
cadViewerControl1.SHXForm.AddPath("E:\\test");
CADConst.DefaultSHXParameters.UseSHXFonts = false;
CADConst.DefaultSHXParameters.UseTTFFonts = true;
Mikhail
Re: apply font folder
Posted: 19 Oct 2016, 05:49
by 윤영철
Please tell us what is wrong.
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);
}
}
}
I have attached sample souece, drawing file, shx font.
Re: apply font folder
Posted: 19 Oct 2016, 18:16
by support
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