Improve Cairo font hinting
This commit is contained in:
@@ -8,7 +8,10 @@ import lime.system.System;
|
||||
class CairoFont {
|
||||
|
||||
|
||||
private static inline var FT_LOAD_FORCE_AUTOHINT = (1 << 5);
|
||||
|
||||
public var font (default, null):Font;
|
||||
|
||||
@:noCompletion public var handle:Dynamic;
|
||||
|
||||
|
||||
@@ -20,7 +23,7 @@ class CairoFont {
|
||||
|
||||
if (font != null && font.src != null) {
|
||||
|
||||
handle = lime_cairo_ft_font_face_create_for_ft_face (font.src, 0);
|
||||
handle = lime_cairo_ft_font_face_create_for_ft_face (font.src, FT_LOAD_FORCE_AUTOHINT);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,29 +1,43 @@
|
||||
package lime.graphics.cairo;
|
||||
import lime.graphics.cairo.CairoSubpixelOrder;
|
||||
import lime.graphics.cairo.CairoSubpixelOrder;
|
||||
import lime.graphics.cairo.CairoSubpixelOrder;
|
||||
|
||||
|
||||
import lime.text.Font;
|
||||
import lime.system.System;
|
||||
|
||||
class CairoFontOptions
|
||||
{
|
||||
|
||||
class CairoFontOptions {
|
||||
|
||||
|
||||
public var antialias (get, set):CairoAntialias;
|
||||
public var subpixelOrder (get, set):CairoSubpixelOrder;
|
||||
public var hintStyle (get, set):CairoHintStyle;
|
||||
public var hintMetrics (get, set):CairoHintMetrics;
|
||||
public var hintStyle (get, set):CairoHintStyle;
|
||||
public var subpixelOrder (get, set):CairoSubpixelOrder;
|
||||
|
||||
@:noCompletion public var handle:Dynamic;
|
||||
|
||||
public function new( handle : Dynamic = null ) {
|
||||
|
||||
|
||||
public function new (handle:Dynamic = null) {
|
||||
|
||||
#if lime_cairo
|
||||
if ( handle == null )
|
||||
handle = lime_cairo_font_options_create();
|
||||
#end
|
||||
if (handle == null) {
|
||||
|
||||
this.handle = handle;
|
||||
}
|
||||
handle = lime_cairo_font_options_create ();
|
||||
|
||||
}
|
||||
#end
|
||||
|
||||
this.handle = handle;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Get & Set Methods
|
||||
|
||||
|
||||
|
||||
|
||||
@:noCompletion private function get_antialias ():CairoAntialias {
|
||||
|
||||
#if lime_cairo
|
||||
@@ -45,6 +59,52 @@ class CairoFontOptions
|
||||
|
||||
}
|
||||
|
||||
|
||||
@:noCompletion private function get_hintMetrics ():CairoHintMetrics {
|
||||
|
||||
#if lime_cairo
|
||||
return lime_cairo_font_options_get_hint_metrics (handle);
|
||||
#end
|
||||
|
||||
return cast 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@:noCompletion private function set_hintMetrics (value:CairoHintMetrics):CairoHintMetrics {
|
||||
|
||||
#if lime_cairo
|
||||
lime_cairo_font_options_set_hint_metrics (handle, value);
|
||||
#end
|
||||
|
||||
return value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@:noCompletion private function get_hintStyle ():CairoHintStyle {
|
||||
|
||||
#if lime_cairo
|
||||
return lime_cairo_font_options_get_hint_style (handle);
|
||||
#end
|
||||
|
||||
return cast 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@:noCompletion private function set_hintStyle (value:CairoHintStyle):CairoHintStyle {
|
||||
|
||||
#if lime_cairo
|
||||
lime_cairo_font_options_set_hint_style (handle, value);
|
||||
#end
|
||||
|
||||
return value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@:noCompletion private function get_subpixelOrder ():CairoSubpixelOrder {
|
||||
|
||||
#if lime_cairo
|
||||
@@ -66,53 +126,25 @@ class CairoFontOptions
|
||||
|
||||
}
|
||||
|
||||
@:noCompletion private function get_hintStyle ():CairoHintStyle {
|
||||
|
||||
#if lime_cairo
|
||||
return lime_cairo_font_options_get_hint_style (handle);
|
||||
#end
|
||||
|
||||
return cast 0;
|
||||
}
|
||||
|
||||
|
||||
@:noCompletion private function set_hintStyle (value:CairoHintStyle):CairoHintStyle {
|
||||
|
||||
#if lime_cairo
|
||||
lime_cairo_font_options_set_hint_style (handle, value);
|
||||
#end
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
@:noCompletion private function get_hintMetrics ():CairoHintMetrics {
|
||||
|
||||
#if lime_cairo
|
||||
return lime_cairo_font_options_get_hint_metrics (handle);
|
||||
#end
|
||||
|
||||
return cast 0;
|
||||
}
|
||||
|
||||
@:noCompletion private function set_hintMetrics (value:CairoHintMetrics):CairoHintMetrics {
|
||||
|
||||
#if lime_cairo
|
||||
lime_cairo_font_options_set_hint_metrics (handle, value);
|
||||
#end
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
// Native Methods
|
||||
|
||||
|
||||
|
||||
|
||||
#if (cpp || neko || nodejs)
|
||||
private static var lime_cairo_font_options_create = System.load ("lime", "lime_cairo_font_options_create", 0);
|
||||
private static var lime_cairo_font_options_get_antialias = System.load ("lime", "lime_cairo_font_options_get_antialias", 1);
|
||||
private static var lime_cairo_font_options_get_subpixel_order = System.load ("lime", "lime_cairo_font_options_get_subpixel_order", 1);
|
||||
private static var lime_cairo_font_options_get_hint_style = System.load ("lime", "lime_cairo_font_options_get_hint_style", 1);
|
||||
private static var lime_cairo_font_options_get_hint_metrics = System.load ("lime", "lime_cairo_font_options_get_hint_metrics", 1);
|
||||
private static var lime_cairo_font_options_get_hint_style = System.load ("lime", "lime_cairo_font_options_get_hint_style", 1);
|
||||
private static var lime_cairo_font_options_get_subpixel_order = System.load ("lime", "lime_cairo_font_options_get_subpixel_order", 1);
|
||||
private static var lime_cairo_font_options_set_antialias = System.load ("lime", "lime_cairo_font_options_set_antialias", 2);
|
||||
private static var lime_cairo_font_options_set_subpixel_order = System.load ("lime", "lime_cairo_font_options_set_subpixel_order", 2);
|
||||
private static var lime_cairo_font_options_set_hint_style = System.load ("lime", "lime_cairo_font_options_set_hint_style", 2);
|
||||
private static var lime_cairo_font_options_set_hint_metrics = System.load ("lime", "lime_cairo_font_options_set_hint_metrics", 2);
|
||||
private static var lime_cairo_font_options_set_hint_style = System.load ("lime", "lime_cairo_font_options_set_hint_style", 2);
|
||||
private static var lime_cairo_font_options_set_subpixel_order = System.load ("lime", "lime_cairo_font_options_set_subpixel_order", 2);
|
||||
#end
|
||||
|
||||
|
||||
}
|
||||
Submodule project/lib/freetype updated: 3ce727ee61...91868e6165
Reference in New Issue
Block a user