Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Get properties in a range of castmembers
Havok Skittles / Bowling Game source code
DirectX / Direct Show
Urdu text editor
SpriTec Xtra! - Export your Cast and Score
Multiple Monitors with Director
Shell Xtra
Dragging and Magnifying a Sprite
Cinemac
Brain Killer (Simon)
 

 

 

Behavior Replace embedded fonts in text/field and button members

Added on 12/7/2005

 

Compatibilities:

This item has not yet been rated

Author: Chunick (website)

Go through and replace embedded fonts with installed fonts in your texts, fields, and built-in director buttons (includes radios and checkboxes too) with this script. It looks for the RTF of a text member or goes through a field/button member character by character (usually these members contain a good deal less text than a text member does).

-- place in a moviescript
on replaceEmbeddedFont(embeddedFont, replacedFont)
theCount = embeddedFont.char.count
castCount = the number of castLibs
repeat with j = 1 to castCount
memCount = the number of members of castlib j
repeat with k = 1 to memCount
Case member(k, j).type of
#text:
theRTF = member(k,j).rtf
theOffset = offset(embeddedFont, theRTF)
theEnd = theOffset + theCount
if theOffset > 0 then
put replacedFont into char theOffset to theEnd of theRTF
member(k,j).rtf = theRTF
member(k,j).text = member(k,j).char[1.. member(k, j).char.count - 1]
end if
#field, #button:
charCount = member(k,j).char.count
theStart = 0
repeat with l = 1 to charCount
if member(k,j).char[l].font = embeddedFont and theStart = 0 then theStart = l
if member(k,j).char[l].font = embeddedFont and theStart > 0 then theEnd = l
if theStart > 0 and theEnd > 0 and member(k,j).char[l].font <> embeddedFont then
member(k,j).char[theStart..theEnd].font = replacedFont
theStart = 0
theEnd = 0
end if
end repeat
end Case
end repeat
end repeat
end

-- To use:
-- from the message window
-- replaceEmbeddedFont("Arial *", "Arial")

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail