Skip to content

Commit ca04459

Browse files
committed
Merge branch 'feature/load-font' of https://github.com/montegoulding/livecode into feature-start_using_font_file
Conflicts: engine/src/executionerrors.h engine/src/parsedef.h engine/src/property.cpp revvideograbber/revvideograbber.xcodeproj/project.pbxproj
2 parents 1465822 + 209a0be commit ca04459

19 files changed

Lines changed: 601 additions & 76 deletions
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<doc>
2+
<name>start using font</name>
3+
<type>command</type>
4+
<syntax>
5+
<example>start using font file <i>fontFile</i> [globally]</example>
6+
</syntax>
7+
<library></library>
8+
<objects>
9+
</objects>
10+
<synonyms>
11+
</synonyms>
12+
<classification>
13+
</classification>
14+
<references>
15+
<function tag="fontNames">fontNames Function</function>
16+
<command tag="stop using font">stop using font Command</command>
17+
<property tag="fontFilesInUse">fontFilesInUse Property</property>
18+
</references>
19+
<history>
20+
<introduced version="6.2">Added.</introduced>
21+
</history>
22+
<platforms>
23+
<mac/>
24+
<windows/>
25+
</platforms>
26+
<classes>
27+
<desktop/>
28+
</classes>
29+
<security>
30+
<disk access="???"/>
31+
</security>
32+
<summary>Loads a font from a font file into memory.</summary>
33+
<examples>
34+
<example>start using font file myFontFile</example>
35+
<example>start using font file "C:/myFontFolder/myCustomFont.ttf" globally</example>
36+
</examples>
37+
<description>
38+
<p>The <b>start using font</b> command loads a font from a font file into memory.</p><p>The <i>fontFile</i> is the path to the font file. Use the globally adverb to indicate that the font should be available to all applications on the system rather than private to the current application.</p><p><b>Value:</b></p><p>If the font was loaded successfully, the <b>start using font</b> command puts empty into the <function tag="result">result</function>. If the font failed to load, the <function tag="result">result</function> will contain an error string. This will be 'can't load font file' if the specifed file could not be loaded as a font.</p><p><b>Note:</b> The <function tag="fontNames">fontNames function</function> will return the name of all available fonts and the <property tag="fontFilesInUse">fontFilesInUse property</property> will return the fill paths of the loaded font files. To determine the name of the newly loaded font, compare the value of the <function tag="fontNames">fontNames</function> before and after loading the font.</p>
39+
</description>
40+
</doc>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<doc>
2+
<name>stop using font</name>
3+
<type>command</type>
4+
<syntax>
5+
<example>stop using font file <i>fontFile</i></example>
6+
</syntax>
7+
<library></library>
8+
<objects>
9+
</objects>
10+
<synonyms>
11+
</synonyms>
12+
<classification>
13+
</classification>
14+
<references>
15+
<function tag="fontNames">fontNames Function</function>
16+
<command tag="start using font">start using font Command</command>
17+
<property tag="fontFilesInUse">fontFilesInUse Property</property>
18+
</references>
19+
<history>
20+
<introduced version="6.2">Added.</introduced>
21+
</history>
22+
<platforms>
23+
<mac/>
24+
<windows/>
25+
</platforms>
26+
<classes>
27+
<desktop/>
28+
</classes>
29+
<security>
30+
<disk access="???"/>
31+
</security>
32+
<summary>Unloads a font file from memory.</summary>
33+
<examples>
34+
<example>stop using font file myFontFile</example>
35+
<example>stop using font file "C:/myFontFolder/myCustomFont.ttf"</example>
36+
</examples>
37+
<description>
38+
<p>The <b>stop using font</b> command unloads a font file from memory.</p><p>The <i>fontFile</i> is the path of the font file to unload</p><p><b>Value:</b></p><p>The <b>stop using font</b> command puts empty into the result if successful. Otherwise an error string is put into the result</p><p><b>Note:</b> The <function tag="fontNames">fontNames function</function> will return the name of all available fonts and the <property tag="fontFilesInUse">fontFilesInUse property</property> will return the fill paths of the loaded font files. To determine the name of the newly unloaded font, compare the value of the <function tag="fontNames">fontNames</function> before and after unloading the font.</p><p><img src="202650"/> <b>Caution!</b></p><p>Ensure fonts are not in use before unloading them to avoid unexpected behaviour.</p>
39+
</description>
40+
</doc>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<doc>
2+
<name>fontFilesInUse</name>
3+
<type>property</type>
4+
<syntax>
5+
<example>get the fontFilesInUse</example>
6+
</syntax>
7+
<library></library>
8+
<objects>
9+
<global/>
10+
</objects>
11+
<synonyms>
12+
</synonyms>
13+
<classification>
14+
</classification>
15+
<references>
16+
<function tag="fontNames">fontNames Function</function>
17+
<command tag="start using font">start using font Command</command>
18+
<command tag="stop using font">stop using font Command</command>
19+
</references>
20+
<history>
21+
<introduced version="6.2">Added.</introduced>
22+
</history>
23+
<platforms>
24+
<mac/>
25+
<windows/>
26+
</platforms>
27+
<classes>
28+
<desktop/>
29+
</classes>
30+
<security>
31+
</security>
32+
<summary>Reports the files that have been loaded into memory by the <command tag="start using font">start using font</command> <glossary tag="command">command</glossary>.</summary>
33+
<examples>
34+
<example>if theFontFile is not among the lines \</p><p> of the fontFilesInUse then start using font file theFontFile</example>
35+
</examples>
36+
<description>
37+
<p>Use the <b>fontFilesInUse</b> <glossary tag="property">property</glossary> to find out which font files are currently in loaded into memory.<p/><p><b>Value:</b></p><p>The <b>fontFilesInUse</b> <glossary tag="property">property</glossary> reports a list of full file paths, one per <keyword tag="line">line</keyword>.<p/><p>This property is read-only and cannot be set.<p/><p><b>Comments:</b><p/><p>Load font files into memory with the <b>start using font</b> <glossary tag="command">command</glossary>; remove them with the <command tag="stop using font">stop using font</command> <glossary tag="command">command</glossary>.</p>
38+
</description>
39+
</doc>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Integration of revFont external
2+
To load a font into memory use:
3+
start using font file *fontFile* [globally]
4+
To unload a font from memory use:
5+
stop using font file *fontFile*
6+
To determine the currently loaded font files use:
7+
the fontFilesInUse property

engine/src/cmds.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,6 +1167,9 @@ class MCStart : public MCStatement
11671167
{
11681168
MCChunk *target;
11691169
MCExpression *stack;
1170+
// TD-2013-06-12: [[ DynamicFonts ]] Property to store font path
1171+
MCExpression *font;
1172+
bool is_globally;
11701173
protected:
11711174
Start_constants mode;
11721175
public:
@@ -1175,6 +1178,9 @@ class MCStart : public MCStatement
11751178
target = NULL;
11761179
stack = NULL;
11771180
mode = SC_UNDEFINED;
1181+
// TD-2013-06-20: [[ DynamicFonts ]] Property to store font path
1182+
font = NULL;
1183+
is_globally = 0;
11781184
}
11791185
virtual ~MCStart();
11801186
virtual Parse_stat parse(MCScriptPoint &);
@@ -1194,12 +1200,16 @@ class MCStop : public MCStatement
11941200
{
11951201
MCChunk *target;
11961202
MCExpression *stack;
1203+
// TD-2013-06-20: [[ DynamicFonts ]] Property to store font path
1204+
MCExpression *font;
11971205
Start_constants mode;
11981206
public:
11991207
MCStop()
12001208
{
12011209
target = NULL;
12021210
stack = NULL;
1211+
// TD-2013-06-20: [[ DynamicFonts ]] Property to store font path
1212+
font = NULL;
12031213
}
12041214
virtual ~MCStop();
12051215
virtual Parse_stat parse(MCScriptPoint &);

0 commit comments

Comments
 (0)