Rick Martin Posted October 10, 2007 Share Posted October 10, 2007 I have some files that are used regularly over the years by many users - they are updated over and over again. So now, there are many fonts embedded into the file, and I am having trouble finding the location of them. Some are specified inside symbols, etc. etc. Font mapping of course solves this, but what I'm wondering is if there is an easy way to change every single font specification in a file to a single font, thus rendering font mapping unnecessary. Thanks! Quote Link to comment
Petri Posted October 10, 2007 Share Posted October 10, 2007 Could be scripted fairly easily. (Not a bad idea at all. Pity I'm not allowed to publish scripts here.) Quote Link to comment
Rick Martin Posted October 10, 2007 Author Share Posted October 10, 2007 It's good to know that there would be a solution - my scripting abilities are way to crude to do it I'm pretty sure. The script could identify each font, and then ask for a substitution, one by one... Well, I don't want to push you Petri to publish such a script somewhere else ; ), but if there are any other ideas out there, I'm open to them. Quote Link to comment
Petri Posted October 10, 2007 Share Posted October 10, 2007 The script could identify each font, and then ask for a substitution, one by one... Possible, but of course it'd be easiest to substitute all with one font. (Typeface, to be exact.) Quote Link to comment
Rick Martin Posted October 10, 2007 Author Share Posted October 10, 2007 Well, I'm smart enough to see that this is a perfect hint for someone half in-the-know, but sadly not smart enough to get it. Hm. I was thinking that I could just open the file in a text editor and replace anything that looks like a font with 'arial', but figure that the chances of that working to be about nil. One single font is actually my goal - ideally I'd be able to choose what it would be. Quote Link to comment
Pat Stanford Posted October 10, 2007 Share Posted October 10, 2007 How about this script. It will replace the font of every object with the current default system font. Thanks to a script by Gerard Jonker for a hint about handling the Dimensions separately. ========================= Procedure ChangeAllFonts; {Changes all of the fonts in a document to the current default font} {? 2007 Coviana, Inc.} {Vectortasks Training - www.vectortasks.com} {PodCAD Podcast - www.podcad.tv} Var H1:Handle; DefaultFont,TextLength,Kind:Integer; S1:String; Procedure ChangeFont(ThisObject:Handle); Begin Kind:=GetType(ThisObject); If Kind <>63 then Begin TextLength:=Len(GetText(ThisObject)); SetTextFont(ThisObject,0,TextLength,DefaultFont); End else Begin SetObjectVariableInteger(ThisObject,28,DefaultFont); ResetObject(ThisObject); End; End; Begin DefaultFont:=GetFontID(GetPrefString(100)); {Get the ID of the active font} ForEachObject(ChangeFont,(INSYMBOL & INOBJECT & INVIEWPORT & (ALL))); RedrawAll; End; Run(ChangeAllFonts); ===================== Pat 1 Quote Link to comment
D Wood Posted October 10, 2007 Share Posted October 10, 2007 Rick The solution may be simpler than you think. Recently when I upgraded to v12.5 from 11.5, some text in files I had used over and over changed typeface - I use Tekton Pro and I think the files reverted to some standard font that comes with VW. Anyway, I just selected everything, went to Text>Font and selected the font I wanted, and all the incorrect text changed, including within groups. I don't know if this applies to symbols, I don't think I have any with text. Have you tried this? Quote Link to comment
Pat Stanford Posted October 10, 2007 Share Posted October 10, 2007 David I think that what you suggest will only work if all of the layers are at the same scale. If you have multiple scales in the drawing, you would have to repeat for every different scale. You would also have to go in and do any viewport annotations separately. I think, that the script will handle all of the above challenges directly. Pat Quote Link to comment
D Wood Posted October 11, 2007 Share Posted October 11, 2007 You're probably right - I did it layer by layer. Quote Link to comment
Petri Posted October 11, 2007 Share Posted October 11, 2007 {? 2007 Coviana, Inc.} Tsk tsk. Are you allowed to claim ? here? I'm not. But a nice script anyway! Why do you exclude dimensions? Quote Link to comment
Pat Stanford Posted October 11, 2007 Share Posted October 11, 2007 Copyright is boilerplate (something that just gets added to every document). I should probably switch to Creative Commons and use a Share Alike for scripts I post here. Dimensions do not respond properly to the same code that works for other objects, so I check for them and handle them separately. I had gotten to the point of Dims not working and went searching my archives. Gerard Jonker had posted a script (via Matt Panzer) to the VectorScript List last week that supposedly does the same as mine, but must do much more because it is about 200 lines long. I noticed that he had pulled the dims out separately and this gave me the key I needed to make it work. Pat Quote Link to comment
Petri Posted October 11, 2007 Share Posted October 11, 2007 Copyright is boilerplate (something that just gets added to every document). I should probably switch to Creative Commons and use a Share Alike for scripts I post here. I don't have a problem with ?! Some others do. Dimensions do not respond properly to the same code that works for other object Ahh - so it seems: ObjectVariableInt 28! Quote Link to comment
Rick Martin Posted October 11, 2007 Author Share Posted October 11, 2007 Hi Pat, First off, thank you so much for the help - your script works like a dream... to a point. All but three fonts in a test file changed to the default system font. It made it a bit easier to find the general location of the other fonts and what I found was that the three that did not change all relate to Spotlight. One font is imbedded somewhere inside a plug-in object which is a Lighting Device, and the other two are inside one or more Lable Legends. I can keep deleting objects, resetting the font mapping, etc. and will sooner or later find it, but if you find that as a puzzle, taking another look is interesting, I'd of course be grateful! Thanks again! Warmly, Quote Link to comment
Rick Martin Posted May 8, 2008 Author Share Posted May 8, 2008 I just updated to 2008, and wanted to add that Pat's script above now works perfectly. Thanks again Pat! Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.