Auto merge of #10937 - pcwalton:mac-helvetica, r=metajack

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

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

Partially addresses #9487.

r? @metajack
cc @paulrouget

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10937)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-05-09 13:02:23 -07:00
commit 180a9813aa
5 changed files with 22 additions and 7 deletions

View file

@ -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");

View file

@ -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";

View file

@ -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";