Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gfx: Map `sans-serif` to Helvetica on Mac and DejaVu Sans on Linux. #10937

Merged
merged 1 commit into from May 9, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

gfx: Map `sans-serif` to Helvetica on Mac, DejaVu Sans on Linux, and

Roboto on Android.

This matches what I believe the OS native defaults to be.

Partially addresses #9487.
  • Loading branch information
pcwalton committed May 9, 2016
commit 2ac974702394c2c8e7804bd634f644b36ad9be3f
@@ -8,6 +8,7 @@ use ipc_channel::router::ROUTER;
use mime::{TopLevel, SubLevel};
use net_traits::{AsyncResponseTarget, LoadContext, PendingAsyncLoad, ResourceThread, ResponseAction};
use platform::font_context::FontContextHandle;
use platform::font_list::SANS_SERIF_FONT_FAMILY;
use platform::font_list::for_each_available_family;
use platform::font_list::for_each_variation;
use platform::font_list::last_resort_font_families;
@@ -120,7 +121,7 @@ fn populate_generic_fonts() -> HashMap<FontFamily, LowercaseString> {
let mut generic_fonts = HashMap::with_capacity(5);

append_map(&mut generic_fonts, FontFamily::Serif, "Times New Roman");
append_map(&mut generic_fonts, FontFamily::SansSerif, "Arial");
append_map(&mut generic_fonts, FontFamily::SansSerif, SANS_SERIF_FONT_FAMILY);
append_map(&mut generic_fonts, FontFamily::Cursive, "Apple Chancery");
append_map(&mut generic_fonts, FontFamily::Fantasy, "Papyrus");
append_map(&mut generic_fonts, FontFamily::Monospace, "Menlo");
@@ -157,3 +157,13 @@ pub fn last_resort_font_families() -> Vec<String> {
"Arial".to_owned()
)
}

#[cfg(target_os = "android")]
pub static SANS_SERIF_FONT_FAMILY: &'static str = "Roboto";

#[cfg(target_os = "linux")]
pub static SANS_SERIF_FONT_FAMILY: &'static str = "DejaVu Sans";

#[cfg(target_os = "windows")]
pub static SANS_SERIF_FONT_FAMILY: &'static str = "Arial";

@@ -41,3 +41,7 @@ pub fn system_default_family(_generic_name: &str) -> Option<String> {
pub fn last_resort_font_families() -> Vec<String> {
vec!("Arial Unicode MS".to_owned(), "Arial".to_owned())
}

#[cfg(target_os = "macos")]
pub static SANS_SERIF_FONT_FAMILY: &'static str = "Helvetica";

@@ -1,4 +1,3 @@
[word-break-normal-bo-000.htm]
type: reftest
expected:
if os == "linux": FAIL
expected: FAIL
@@ -4,16 +4,17 @@
<meta charset="utf-8">
<title>input selection incremental reference</title>
<style>
body {
font: 16px sans-serif;
}
.selection {
color: white;
background: rgba(176, 214, 255, 1.0);
}
div {
font: 16px sans-serif;
display: inline-block;
}
</style>
</head>
<body>
<span class="selection">H</span>ello
<div><span class="selection">H</span>ello</div>
</body>
</html>
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.