Jump to content

Replace or clear out fonts


Recommended Posts

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!

Link to comment

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.

Link to comment

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.

Link to comment

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

  • Like 1
Link to comment

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?

Link to comment

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

Link to comment

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

Link to comment
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!

Link to comment

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,

Link to comment
  • 6 months later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...