Make Font metrics properties writable
This commit is contained in:
committed by
Joshua Granick
parent
d1a4e0cfea
commit
e376fd206e
@@ -40,15 +40,15 @@ import haxe.io.Path;
|
|||||||
class Font {
|
class Font {
|
||||||
|
|
||||||
|
|
||||||
public var ascender (get, null):Int;
|
@:isVar public var ascender (get, set):Null<Int>; // no "= 0", cause asset sub-classes set properties before calling
|
||||||
public var descender (get, null):Int;
|
@:isVar public var descender (get, set):Null<Int>; // super(). better indicate a missing value with null anyway.
|
||||||
public var height (get, null):Int;
|
public var height (get, null):Int;
|
||||||
public var name (default, null):String;
|
public var name (default, null):String;
|
||||||
public var numGlyphs (get, null):Int;
|
public var numGlyphs (get, null):Int;
|
||||||
public var src:Dynamic;
|
public var src:Dynamic;
|
||||||
public var underlinePosition (get, null):Int;
|
public var underlinePosition (get, null):Int;
|
||||||
public var underlineThickness (get, null):Int;
|
public var underlineThickness (get, null):Int;
|
||||||
public var unitsPerEM (get, null):Int;
|
@:isVar public var unitsPerEM (get, set):Null<Int>;
|
||||||
|
|
||||||
@:noCompletion private var __fontID:String;
|
@:noCompletion private var __fontID:String;
|
||||||
@:noCompletion private var __fontPath:String;
|
@:noCompletion private var __fontPath:String;
|
||||||
@@ -584,28 +584,42 @@ class Font {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
private function get_ascender ():Int {
|
private function get_ascender ():Null<Int> {
|
||||||
|
|
||||||
#if (lime_cffi && !macro)
|
#if (lime_cffi && !macro)
|
||||||
return NativeCFFI.lime_font_get_ascender (src);
|
return NativeCFFI.lime_font_get_ascender (src);
|
||||||
#else
|
#else
|
||||||
return 0;
|
return ascender;
|
||||||
#end
|
#end
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function get_descender ():Int {
|
private function set_ascender (value:Null<Int>):Null<Int> {
|
||||||
|
|
||||||
|
return ascender = value;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function get_descender ():Null<Int> {
|
||||||
|
|
||||||
#if (lime_cffi && !macro)
|
#if (lime_cffi && !macro)
|
||||||
return NativeCFFI.lime_font_get_descender (src);
|
return NativeCFFI.lime_font_get_descender (src);
|
||||||
#else
|
#else
|
||||||
return 0;
|
return descender;
|
||||||
#end
|
#end
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function set_descender (value:Null<Int>):Null<Int> {
|
||||||
|
|
||||||
|
return descender = value;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private function get_height ():Int {
|
private function get_height ():Int {
|
||||||
|
|
||||||
#if (lime_cffi && !macro)
|
#if (lime_cffi && !macro)
|
||||||
@@ -650,17 +664,24 @@ class Font {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function get_unitsPerEM ():Int {
|
private function get_unitsPerEM ():Null<Int> {
|
||||||
|
|
||||||
#if (lime_cffi && !macro)
|
#if (lime_cffi && !macro)
|
||||||
return NativeCFFI.lime_font_get_units_per_em (src);
|
return NativeCFFI.lime_font_get_units_per_em (src);
|
||||||
#else
|
#else
|
||||||
return 0;
|
return unitsPerEM;
|
||||||
#end
|
#end
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function set_unitsPerEM (value:Null<Int>):Null<Int> {
|
||||||
|
|
||||||
|
return unitsPerEM = value;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Native Methods
|
// Native Methods
|
||||||
|
|||||||
Reference in New Issue
Block a user