VS:GetFontName: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
m (1 revision)
(update remark)
Line 33: Line 33:


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<remark>
<remark> ([[User:Orso.b.schmid|Orso]] 2016.03.05): Upon passing an illegal font index it returns:
returns &quot;&quot; if the FontID is not legal.</remark>
* before VW 2015: an empty string
* after VW 2015: the string "System font regular".
After VW 2015 you can use [[VS:GetFontListSize]] to fetch the count of installed fonts. Before that you had to check in both negative and positive direction the whole integer limit: from -32767 to +32767.
</remark>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------

Revision as of 09:29, 5 March 2016

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Function GetFontName converts a system font ID to a font name.

An integer ID with a value representing a font in the current operating system.

FUNCTION GetFontName(
fontID :INTEGER) : STRING;
def vs.GetFontName(fontID):
    return STRING

Parameters

fontID INTEGER Font ID value.

Remarks

(Orso 2016.03.05): Upon passing an illegal font index it returns:

  • before VW 2015: an empty string
  • after VW 2015: the string "System font regular".

After VW 2015 you can use VS:GetFontListSize to fetch the count of installed fonts. Before that you had to check in both negative and positive direction the whole integer limit: from -32767 to +32767.

Example

VectorScript

PROCEDURE Example;
VAR
str :STRING;
cnt :INTEGER;
BEGIN
FOR cnt := 0 to 10 DO str := Concat(str, Chr(13), GetFontName(cnt));
AlrtDialog(str);
END;
RUN(Example);

Python

def Example():
	str = ''
	for cnt in range(0,10):
		str = vs.Concat(str, vs.Chr(13), vs.GetFontName(cnt))
	vs.AlrtDialog(str)
Example()

Version

Availability: from VectorWorks8.0