Oolite 1.91.0.7644-241112-7f5034b
Loading...
Searching...
No Matches
OOJSFont.m File Reference
import "OOJSFont.h"
import "OOJavaScriptEngine.h"
import "HeadUpDisplay.h"
+ Include dependency graph for OOJSFont.m:

Go to the source code of this file.

Functions

static JSBool FontMeasureString (JSContext *context, uintN argc, jsval *vp)
 
void InitOOJSFont (JSContext *context, JSObject *global)
 

Function Documentation

◆ FontMeasureString()

static JSBool FontMeasureString ( JSContext * context,
uintN argc,
jsval * vp )
static

Definition at line 47 of file OOJSFont.m.

48{
49 OOJS_NATIVE_ENTER(context)
50
51 if (EXPECT_NOT(argc < 1) || JSVAL_IS_VOID(OOJS_ARGV[0]))
52 {
53 jsval undefined = JSVAL_VOID;
54 OOJSReportBadArguments(context, nil, @"defaultFont.measureString", MIN(argc, 1U), &undefined, nil, @"string");
55 return NO;
56 }
57
59
61}
CGFloat OOStringWidthInEm(NSString *text)
#define EXPECT_NOT(x)
#define OOJS_NATIVE_ENTER(cx)
#define OOJS_NATIVE_EXIT
#define OOJS_RETURN_DOUBLE(value)
NSString * OOStringFromJSValue(JSContext *context, jsval value)
#define OOJS_ARGV
void OOJSReportBadArguments(JSContext *context, NSString *scriptClass, NSString *function, uintN argc, jsval *argv, NSString *message, NSString *expectedArgsDescription)
#define MIN(A, B)
Definition OOMaths.h:111
return nil

References EXPECT_NOT, MIN, nil, OOJS_ARGV, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJS_RETURN_DOUBLE, OOJSReportBadArguments(), OOStringFromJSValue(), and OOStringWidthInEm().

Referenced by InitOOJSFont().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InitOOJSFont()

void InitOOJSFont ( JSContext * context,
JSObject * global )

Definition at line 38 of file OOJSFont.m.

39{
40 JSObject *fontObject = JS_DefineObject(context, global, "defaultFont", NULL, NULL, OOJS_PROP_READONLY);
41 JS_DefineFunction(context, fontObject, "measureString", FontMeasureString, 1, OOJS_METHOD_READONLY);
42}
static JSBool FontMeasureString(JSContext *context, uintN argc, jsval *vp)
Definition OOJSFont.m:47
#define OOJS_PROP_READONLY
#define OOJS_METHOD_READONLY

References FontMeasureString(), OOJS_METHOD_READONLY, and OOJS_PROP_READONLY.

+ Here is the call graph for this function: