Hi,
The attached drawing has two bits of text that are identical except from the font style.
They look different.
Is someone able to explain the difference between 'Regular' and no font style.
How do I acheive the 'blank' font style instead of Regular?
On the quick glance one textstyle is uses "romans.shx" font
and another one "romans__.ttf" but in the textstyle editor
you can see only "romans.shx" for both styles
I have also same problem with creating styles in lisp, where
I added fontname without extension like "romans",
better yet to use it with extension,
sorry I can't explain more at the moment
This problem is the ambiguous name between Windows True Type font RomanS (romans__.ttf) and AutoCAD SHX font romans.shx. I hope Autodesk will fix this text style name issue in next releases.
AutoCAD shows RomanS true type font as the same name romans.shx of SHX font in the Text Style dialog. So if there are two TTF and SHX fonts that have the same name, the SHX font name will show on AutoCAD, and TTF font name is invisible.
Both two fonts look similar, except RomanS is thicker than romans.shx. This has been confusing users for years why the same font name but have different thickness. In fact, they are two different fonts (in different text styles) but wearing the same name!
To archive the “blank” font style instead of Regular, you should change the true type font RomanS (it’s invisible in AutoCAD) to the real SHX font by code. Without writing code, on AutoCAD Text Style dialog, we can do a trick to change the font name romans.shx (of TTF thick font) to any font and then reverse it back. It will remove the TTF font and get the correct SHX font. We also need to run REGEN command for the drawing to display updated text styles.
-Khoa
Here is the code to fix the RomanS font, change Windows true type font to AutoCAD SHX font:
[CommandMethod("FixRomansShxFont")] public static void FixRomansShxFont() { Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; FixRomansShxFont(db); doc.Editor.Regen(); } public static void FixRomansShxFont(Database db) { using (Transaction trans = db.TransactionManager.StartTransaction()) { var textStyleTable = (TextStyleTable)trans.GetObject(db.TextStyleTableId, OpenMode.ForRead); foreach (ObjectId textStyleId in textStyleTable) { var textStyle = (TextStyleTableRecord)trans.GetObject(textStyleId, OpenMode.ForRead); if (textStyle.FileName.Equals("romans__.ttf", StringComparison.CurrentCultureIgnoreCase)) { textStyle.UpgradeOpen(); textStyle.FileName = "romans.shx"; textStyle.DowngradeOpen(); } } trans.Commit(); } }
-Khoa
Agreed, you're correct, the following sample just for dysplay this result
<CommandMethod("atx")> _ Public Shared Sub testAddTextStyle() Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument Dim db As Database = doc.Database Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("textfill", 1) Using trans As Transaction = db.TransactionManager.StartTransaction() Try Dim txtb As TextStyleTable = DirectCast(trans.GetObject(db.TextStyleTableId, OpenMode.ForWrite, False), TextStyleTable) Dim txtstrec As TextStyleTableRecord = New TextStyleTableRecord() txtstrec.SetPaperOrientation(True) txtstrec.Name = "style1-test" txtstrec.FileName = "romans__.ttf" ''2 underscore characters txtstrec.ObliquingAngle = 0.0 txtstrec.PriorSize = 0.18 txtstrec.TextSize = 225.0 txtstrec.XScale = 0.75 txtb.Add(txtstrec) trans.AddNewlyCreatedDBObject(txtstrec, True) db.Textstyle = txtstrec.ObjectId trans.TransactionManager.QueueForGraphicsFlush() Dim txtstrec2 As TextStyleTableRecord = New TextStyleTableRecord() txtstrec.SetPaperOrientation(True) txtstrec2.Name = "style2-test" txtstrec2.FileName = "romans.shx" txtstrec2.ObliquingAngle = 0.0 txtstrec2.PriorSize = 0.18 txtstrec2.TextSize = 225.0 txtstrec2.XScale = 0.75 txtb.Add(txtstrec2) trans.AddNewlyCreatedDBObject(txtstrec2, True) db.Textstyle = txtstrec2.ObjectId txtb.DowngradeOpen() doc.TransactionManager.FlushGraphics() trans.Commit() Catch ex As System.Exception MessageBox.Show(ex.StackTrace & vbLf & ex.StackTrace) End Try End Using Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("textfill", 0) End Sub
I think it is a very old bug (since early AutoCAD versions until now) that Autodesk should fix. AutoCAD does not show the name of TTF (Windows True Type) font that has the same present name with SHX font. Or the SHF font does suppress the name display of TTF font. Even they have different properties on the Text Style dialog but using the same SHX name.
The following snapshots will present more about this issue:
Correct romans.shx font name with its SHX properties:
Incorrect romans.shx font name with properties of RomanS TTF font (romans__.ttf). The name in the red ellipse markup should be RomanS with the icon of TTF font.
From those above images, RomanS TTF has lineweight and thicker than romans.shx. They look almost similar that mislead users the same font name, but in fact they are different.
-Khoa
Can't find what you're looking for? Ask the community or share your knowledge.