mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Disable subpixel text antialiasing for ServoSurface
This commit is contained in:
parent
e0ce73abb2
commit
5ddb8d577f
8 changed files with 22 additions and 2 deletions
|
@ -968,6 +968,11 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
|
||||||
.as_boolean()
|
.as_boolean()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
let enable_subpixel_text_antialiasing = !debug_options.disable_subpixel_aa && PREFS
|
||||||
|
.get("gfx.subpixel-text-antialiasing.enabled")
|
||||||
|
.as_boolean()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
let is_printing_version = opt_match.opt_present("v") || opt_match.opt_present("version");
|
let is_printing_version = opt_match.opt_present("v") || opt_match.opt_present("version");
|
||||||
|
|
||||||
let opts = Opts {
|
let opts = Opts {
|
||||||
|
@ -1003,7 +1008,7 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
|
||||||
show_debug_fragment_borders: debug_options.show_fragment_borders,
|
show_debug_fragment_borders: debug_options.show_fragment_borders,
|
||||||
show_debug_parallel_layout: debug_options.show_parallel_layout,
|
show_debug_parallel_layout: debug_options.show_parallel_layout,
|
||||||
enable_text_antialiasing: !debug_options.disable_text_aa,
|
enable_text_antialiasing: !debug_options.disable_text_aa,
|
||||||
enable_subpixel_text_antialiasing: !debug_options.disable_subpixel_aa,
|
enable_subpixel_text_antialiasing: enable_subpixel_text_antialiasing,
|
||||||
enable_canvas_antialiasing: !debug_options.disable_canvas_aa,
|
enable_canvas_antialiasing: !debug_options.disable_canvas_aa,
|
||||||
dump_style_tree: debug_options.dump_style_tree,
|
dump_style_tree: debug_options.dump_style_tree,
|
||||||
dump_rule_tree: debug_options.dump_rule_tree,
|
dump_rule_tree: debug_options.dump_rule_tree,
|
||||||
|
|
|
@ -11,7 +11,7 @@ use servo::euclid::{Length, TypedPoint2D, TypedScale, TypedSize2D, TypedVector2D
|
||||||
use servo::msg::constellation_msg::TraversalDirection;
|
use servo::msg::constellation_msg::TraversalDirection;
|
||||||
use servo::script_traits::{MouseButton, TouchEventType};
|
use servo::script_traits::{MouseButton, TouchEventType};
|
||||||
use servo::servo_config::opts;
|
use servo::servo_config::opts;
|
||||||
use servo::servo_config::prefs::PREFS;
|
use servo::servo_config::prefs::{PrefValue, PREFS};
|
||||||
use servo::servo_url::ServoUrl;
|
use servo::servo_url::ServoUrl;
|
||||||
use servo::style_traits::DevicePixel;
|
use servo::style_traits::DevicePixel;
|
||||||
use std::cell::{Cell, RefCell};
|
use std::cell::{Cell, RefCell};
|
||||||
|
@ -34,6 +34,7 @@ pub struct InitOptions {
|
||||||
pub width: u32,
|
pub width: u32,
|
||||||
pub height: u32,
|
pub height: u32,
|
||||||
pub density: f32,
|
pub density: f32,
|
||||||
|
pub enable_subpixel_text_antialiasing: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Delegate resource file reading to the embedder.
|
/// Delegate resource file reading to the embedder.
|
||||||
|
@ -115,6 +116,9 @@ pub fn init(
|
||||||
})?;
|
})?;
|
||||||
// opts::from_cmdline_args expects the first argument to be the binary name.
|
// opts::from_cmdline_args expects the first argument to be the binary name.
|
||||||
args.insert(0, "servo".to_string());
|
args.insert(0, "servo".to_string());
|
||||||
|
|
||||||
|
let pref = PrefValue::Boolean(init_opts.enable_subpixel_text_antialiasing);
|
||||||
|
PREFS.set("gfx.subpixel-text-antialiasing.enabled", pref);
|
||||||
opts::from_cmdline_args(&args);
|
opts::from_cmdline_args(&args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ pub struct CInitOptions {
|
||||||
pub width: u32,
|
pub width: u32,
|
||||||
pub height: u32,
|
pub height: u32,
|
||||||
pub density: f32,
|
pub density: f32,
|
||||||
|
pub enable_subpixel_text_antialiasing: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The returned string is not freed. This will leak.
|
/// The returned string is not freed. This will leak.
|
||||||
|
@ -75,6 +76,7 @@ fn init(
|
||||||
width: opts.width,
|
width: opts.width,
|
||||||
height: opts.height,
|
height: opts.height,
|
||||||
density: opts.density,
|
density: opts.density,
|
||||||
|
enable_subpixel_text_antialiasing: opts.enable_subpixel_text_antialiasing,
|
||||||
};
|
};
|
||||||
|
|
||||||
let wakeup = Box::new(WakeupCallback::new(wakeup));
|
let wakeup = Box::new(WakeupCallback::new(wakeup));
|
||||||
|
|
|
@ -596,12 +596,17 @@ fn get_options(env: &JNIEnv, opts: JObject) -> Result<(InitOptions, bool, Option
|
||||||
let log = get_non_null_field(env, opts, "enableLogs", "Z")?
|
let log = get_non_null_field(env, opts, "enableLogs", "Z")?
|
||||||
.z()
|
.z()
|
||||||
.map_err(|_| "enableLogs not a boolean")?;
|
.map_err(|_| "enableLogs not a boolean")?;
|
||||||
|
let enable_subpixel_text_antialiasing =
|
||||||
|
get_non_null_field(env, opts, "enableSubpixelTextAntialiasing", "Z")?
|
||||||
|
.z()
|
||||||
|
.map_err(|_| "enableSubpixelTextAntialiasing not a boolean")?;
|
||||||
let opts = InitOptions {
|
let opts = InitOptions {
|
||||||
args,
|
args,
|
||||||
url,
|
url,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
density,
|
density,
|
||||||
|
enable_subpixel_text_antialiasing,
|
||||||
};
|
};
|
||||||
Ok((opts, log, log_str))
|
Ok((opts, log, log_str))
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
"dom.webgl2.enabled": false,
|
"dom.webgl2.enabled": false,
|
||||||
"dom.webvr.enabled": false,
|
"dom.webvr.enabled": false,
|
||||||
"dom.webvr.event_polling_interval": 500,
|
"dom.webvr.event_polling_interval": 500,
|
||||||
|
"gfx.subpixel-text-antialiasing.enabled": true,
|
||||||
"js.asmjs.enabled": true,
|
"js.asmjs.enabled": true,
|
||||||
"js.asyncstack.enabled": false,
|
"js.asyncstack.enabled": false,
|
||||||
"js.baseline.enabled": true,
|
"js.baseline.enabled": true,
|
||||||
|
|
|
@ -60,6 +60,7 @@ public class JNIServo {
|
||||||
public int width = 0;
|
public int width = 0;
|
||||||
public int height = 0;
|
public int height = 0;
|
||||||
public float density = 1;
|
public float density = 1;
|
||||||
|
public boolean enableSubpixelTextAntialiasing = true;
|
||||||
public String logStr;
|
public String logStr;
|
||||||
public boolean enableLogs = false;
|
public boolean enableLogs = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,6 +213,7 @@ public class ServoSurface {
|
||||||
options.url = mInitialUri == null ? null : mInitialUri;
|
options.url = mInitialUri == null ? null : mInitialUri;
|
||||||
options.logStr = mServoLog;
|
options.logStr = mServoLog;
|
||||||
options.enableLogs = true;
|
options.enableLogs = true;
|
||||||
|
options.enableSubpixelTextAntialiasing = false;
|
||||||
|
|
||||||
mServo = new Servo(options, this, surface, mClient, mActivity);
|
mServo = new Servo(options, this, surface, mClient, mActivity);
|
||||||
});
|
});
|
||||||
|
|
|
@ -141,6 +141,7 @@ public class ServoView extends GLSurfaceView
|
||||||
options.width = getWidth();
|
options.width = getWidth();
|
||||||
options.height = getHeight();
|
options.height = getHeight();
|
||||||
options.enableLogs = true;
|
options.enableLogs = true;
|
||||||
|
options.enableSubpixelTextAntialiasing = true;
|
||||||
DisplayMetrics metrics = new DisplayMetrics();
|
DisplayMetrics metrics = new DisplayMetrics();
|
||||||
mActivity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
mActivity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||||
options.density = metrics.density;
|
options.density = metrics.density;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue