mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Update font-kit and freetype and unicode-script.
This commit is contained in:
parent
327fed6084
commit
5c0d7998bd
6 changed files with 221 additions and 28 deletions
69
Cargo.lock
generated
69
Cargo.lock
generated
|
@ -987,6 +987,19 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-graphics"
|
||||
version = "0.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6082396a349fa49674ba1bda4077332a18bf150e8fa75745ece07085e29a113"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"core-foundation 0.9.0",
|
||||
"core-graphics-types",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-graphics-types"
|
||||
version = "0.1.0"
|
||||
|
@ -1011,6 +1024,18 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-text"
|
||||
version = "19.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04dfae50af11e72657fe7174cddb1ecddc5398037f7f6f39533ad69207c9a4e2"
|
||||
dependencies = [
|
||||
"core-foundation 0.9.0",
|
||||
"core-graphics 0.22.0",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
version = "1.2.0"
|
||||
|
@ -1558,19 +1583,19 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
|||
|
||||
[[package]]
|
||||
name = "font-kit"
|
||||
version = "0.9.0"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22ed9b6d89600e22d9bfcfdd8c27e981540664a1a85a3f3971793c75502f49d9"
|
||||
checksum = "1f9042cb45150fb2b2a012fc03d0f1d2071f18e90397b9d2a5ec8ade8464bf20"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"byteorder",
|
||||
"core-foundation 0.7.0",
|
||||
"core-graphics 0.19.0",
|
||||
"core-text",
|
||||
"core-foundation 0.9.0",
|
||||
"core-graphics 0.22.0",
|
||||
"core-text 19.0.0",
|
||||
"dirs",
|
||||
"dwrote",
|
||||
"float-ord",
|
||||
"freetype 0.5.1",
|
||||
"freetype 0.7.0",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"log",
|
||||
|
@ -1618,9 +1643,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "freetype"
|
||||
version = "0.5.1"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b73222ab32d9ad65fe0e1c3258da8d614fd47cf19fce92b09eb520060c5c5ad5"
|
||||
checksum = "bee38378a9e3db1cc693b4f88d166ae375338a0ff75cb8263e1c601d51f35dc6"
|
||||
dependencies = [
|
||||
"freetype-sys",
|
||||
"libc",
|
||||
|
@ -1628,9 +1653,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "freetype-sys"
|
||||
version = "0.11.0"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d48ac0ce366dd47a115ec8e598d7c51b4a974fc52ded5e53a56b31f55f34f3ea"
|
||||
checksum = "a37d4011c0cc628dfa766fcc195454f4b068d7afdc2adfd28861191d866e731a"
|
||||
dependencies = [
|
||||
"cmake",
|
||||
"libc",
|
||||
|
@ -1847,12 +1872,12 @@ dependencies = [
|
|||
"byteorder",
|
||||
"core-foundation 0.7.0",
|
||||
"core-graphics 0.19.0",
|
||||
"core-text",
|
||||
"core-text 15.0.0",
|
||||
"dwrote",
|
||||
"euclid",
|
||||
"fnv",
|
||||
"fontsan",
|
||||
"freetype 0.5.1",
|
||||
"freetype 0.7.0",
|
||||
"gfx_traits",
|
||||
"harfbuzz-sys",
|
||||
"ipc-channel",
|
||||
|
@ -2467,15 +2492,15 @@ checksum = "63d68db75012a85555434ee079e7e6337931f87a087ab2988becbadf64673a7f"
|
|||
|
||||
[[package]]
|
||||
name = "harfbuzz-sys"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c50680ef38c3c83947499b5df4f340db5b436807dfa2b21330d86254e2e4dd6"
|
||||
checksum = "bf8c27ca13930dc4ffe474880040fe9e0f03c2121600dc9c95423624cab3e467"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"core-graphics 0.19.0",
|
||||
"core-text",
|
||||
"core-graphics 0.22.0",
|
||||
"core-text 19.0.0",
|
||||
"foreign-types",
|
||||
"freetype 0.5.1",
|
||||
"freetype 0.7.0",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
|
@ -4334,7 +4359,7 @@ dependencies = [
|
|||
"bitflags",
|
||||
"crc32fast",
|
||||
"deflate",
|
||||
"miniz_oxide",
|
||||
"miniz_oxide 0.3.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -4544,7 +4569,7 @@ checksum = "a871f1e45a3a3f0c73fb60343c811238bb5143a81642e27c2ac7aac27ff01a63"
|
|||
[[package]]
|
||||
name = "raqote"
|
||||
version = "0.8.1-alpha.0"
|
||||
source = "git+https://github.com/jrmuizel/raqote#5444a1040bd4fd72e860ff75244fbe8fa7814470"
|
||||
source = "git+https://github.com/jdm/raqote?branch=fkup#ff5d2d1aa7813dbcacb0d028cf7d17c82a35d9d4"
|
||||
dependencies = [
|
||||
"euclid",
|
||||
"font-kit",
|
||||
|
@ -5116,9 +5141,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "servo-fontconfig-sys"
|
||||
version = "5.0.1"
|
||||
version = "5.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c5e8d42c2957f6f433d90ab61277ed0226b3f49fffb19aa5493213c42e5d6df"
|
||||
checksum = "e36b879db9892dfa40f95da1c38a835d41634b825fbd8c4c418093d53c24b388"
|
||||
dependencies = [
|
||||
"expat-sys",
|
||||
"freetype-sys",
|
||||
|
@ -6803,7 +6828,7 @@ dependencies = [
|
|||
"cfg-if",
|
||||
"core-foundation 0.7.0",
|
||||
"core-graphics 0.19.0",
|
||||
"core-text",
|
||||
"core-text 15.0.0",
|
||||
"cstr",
|
||||
"dwrote",
|
||||
"euclid",
|
||||
|
|
|
@ -32,6 +32,9 @@ mio = { git = "https://github.com/servo/mio.git", branch = "servo-mio-0.6.22" }
|
|||
# https://github.com/rust-lang/backtrace-rs/pull/363/
|
||||
backtrace = { git = "https://github.com/servo/backtrace-rs", branch = "uwp-fix" }
|
||||
|
||||
[patch."https://github.com/jrmuizel/raqote"]
|
||||
raqote = { git = "https://github.com/jdm/raqote", branch = "fkup" }
|
||||
|
||||
# https://github.com/servo/servo/issues/27039#issuecomment-654400150
|
||||
[patch."https://github.com/servo/webrender"]
|
||||
webrender = { git = "https://github.com/jdm/webrender", branch = "crash-backtrace" }
|
||||
|
|
|
@ -22,7 +22,7 @@ canvas_traits = { path = "../canvas_traits" }
|
|||
crossbeam-channel = "0.4"
|
||||
cssparser = "0.27"
|
||||
euclid = "0.20"
|
||||
font-kit = "0.9"
|
||||
font-kit = "0.10"
|
||||
fnv = "1.0"
|
||||
gfx = { path = "../gfx" }
|
||||
gleam = "0.11"
|
||||
|
|
|
@ -20,7 +20,7 @@ euclid = "0.20"
|
|||
fnv = "1.0"
|
||||
fontsan = { git = "https://github.com/servo/fontsan" }
|
||||
gfx_traits = { path = "../gfx_traits" }
|
||||
harfbuzz-sys = "0.4"
|
||||
harfbuzz-sys = "0.5"
|
||||
ipc-channel = "0.14"
|
||||
lazy_static = "1"
|
||||
libc = "0.2"
|
||||
|
@ -48,7 +48,7 @@ core-graphics = "0.19"
|
|||
core-text = "15.0"
|
||||
|
||||
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
|
||||
freetype = "0.5"
|
||||
freetype = "0.7"
|
||||
servo_allocator = { path = "../allocator" }
|
||||
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
|
|
|
@ -191,6 +191,171 @@ impl Shaper {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn unicode_to_hb_script(script: unicode_script::Script) -> harfbuzz_sys::hb_script_t {
|
||||
use harfbuzz_sys::*;
|
||||
use unicode_script::Script::*;
|
||||
match script {
|
||||
Adlam => HB_SCRIPT_ADLAM,
|
||||
Ahom => HB_SCRIPT_AHOM,
|
||||
Anatolian_Hieroglyphs => HB_SCRIPT_ANATOLIAN_HIEROGLYPHS,
|
||||
Arabic => HB_SCRIPT_ARABIC,
|
||||
Armenian => HB_SCRIPT_ARMENIAN,
|
||||
Avestan => HB_SCRIPT_AVESTAN,
|
||||
Balinese => HB_SCRIPT_BALINESE,
|
||||
Bamum => HB_SCRIPT_BAMUM,
|
||||
Bassa_Vah => HB_SCRIPT_BASSA_VAH,
|
||||
Batak => HB_SCRIPT_BATAK,
|
||||
Bengali => HB_SCRIPT_BENGALI,
|
||||
Bhaiksuki => HB_SCRIPT_BHAIKSUKI,
|
||||
Bopomofo => HB_SCRIPT_BOPOMOFO,
|
||||
Brahmi => HB_SCRIPT_BRAHMI,
|
||||
Braille => HB_SCRIPT_BRAILLE,
|
||||
Buginese => HB_SCRIPT_BUGINESE,
|
||||
Buhid => HB_SCRIPT_BUHID,
|
||||
Canadian_Aboriginal => HB_SCRIPT_CANADIAN_SYLLABICS,
|
||||
Carian => HB_SCRIPT_CARIAN,
|
||||
Caucasian_Albanian => HB_SCRIPT_CAUCASIAN_ALBANIAN,
|
||||
Chakma => HB_SCRIPT_CHAKMA,
|
||||
Cham => HB_SCRIPT_CHAM,
|
||||
Cherokee => HB_SCRIPT_CHEROKEE,
|
||||
Chorasmian => HB_SCRIPT_CHORASMIAN,
|
||||
Common => HB_SCRIPT_COMMON,
|
||||
Coptic => HB_SCRIPT_COPTIC,
|
||||
Cuneiform => HB_SCRIPT_CUNEIFORM,
|
||||
Cypriot => HB_SCRIPT_CYPRIOT,
|
||||
Cyrillic => HB_SCRIPT_CYRILLIC,
|
||||
Deseret => HB_SCRIPT_DESERET,
|
||||
Devanagari => HB_SCRIPT_DEVANAGARI,
|
||||
Dives_Akuru => HB_SCRIPT_DIVES_AKURU,
|
||||
Dogra => HB_SCRIPT_DOGRA,
|
||||
Duployan => HB_SCRIPT_DUPLOYAN,
|
||||
Egyptian_Hieroglyphs => HB_SCRIPT_EGYPTIAN_HIEROGLYPHS,
|
||||
Elbasan => HB_SCRIPT_ELBASAN,
|
||||
Elymaic => HB_SCRIPT_ELYMAIC,
|
||||
Ethiopic => HB_SCRIPT_ETHIOPIC,
|
||||
Georgian => HB_SCRIPT_GEORGIAN,
|
||||
Glagolitic => HB_SCRIPT_GLAGOLITIC,
|
||||
Gothic => HB_SCRIPT_GOTHIC,
|
||||
Grantha => HB_SCRIPT_GRANTHA,
|
||||
Greek => HB_SCRIPT_GREEK,
|
||||
Gujarati => HB_SCRIPT_GUJARATI,
|
||||
Gunjala_Gondi => HB_SCRIPT_GUNJALA_GONDI,
|
||||
Gurmukhi => HB_SCRIPT_GURMUKHI,
|
||||
Han => HB_SCRIPT_HAN,
|
||||
Hangul => HB_SCRIPT_HANGUL,
|
||||
Hanifi_Rohingya => HB_SCRIPT_HANIFI_ROHINGYA,
|
||||
Hanunoo => HB_SCRIPT_HANUNOO,
|
||||
Hatran => HB_SCRIPT_HATRAN,
|
||||
Hebrew => HB_SCRIPT_HEBREW,
|
||||
Hiragana => HB_SCRIPT_HIRAGANA,
|
||||
Imperial_Aramaic => HB_SCRIPT_IMPERIAL_ARAMAIC,
|
||||
Inherited => HB_SCRIPT_INHERITED,
|
||||
Inscriptional_Pahlavi => HB_SCRIPT_INSCRIPTIONAL_PAHLAVI,
|
||||
Inscriptional_Parthian => HB_SCRIPT_INSCRIPTIONAL_PARTHIAN,
|
||||
Javanese => HB_SCRIPT_JAVANESE,
|
||||
Kaithi => HB_SCRIPT_KAITHI,
|
||||
Kannada => HB_SCRIPT_KANNADA,
|
||||
Katakana => HB_SCRIPT_KATAKANA,
|
||||
Kayah_Li => HB_SCRIPT_KAYAH_LI,
|
||||
Kharoshthi => HB_SCRIPT_KHAROSHTHI,
|
||||
Khitan_Small_Script => HB_SCRIPT_KHITAN_SMALL_SCRIPT,
|
||||
Khmer => HB_SCRIPT_KHMER,
|
||||
Khojki => HB_SCRIPT_KHOJKI,
|
||||
Khudawadi => HB_SCRIPT_KHUDAWADI,
|
||||
Lao => HB_SCRIPT_LAO,
|
||||
Latin => HB_SCRIPT_LATIN,
|
||||
Lepcha => HB_SCRIPT_LEPCHA,
|
||||
Limbu => HB_SCRIPT_LIMBU,
|
||||
Linear_A => HB_SCRIPT_LINEAR_A,
|
||||
Linear_B => HB_SCRIPT_LINEAR_B,
|
||||
Lisu => HB_SCRIPT_LISU,
|
||||
Lycian => HB_SCRIPT_LYCIAN,
|
||||
Lydian => HB_SCRIPT_LYDIAN,
|
||||
Mahajani => HB_SCRIPT_MAHAJANI,
|
||||
Makasar => HB_SCRIPT_MAKASAR,
|
||||
Malayalam => HB_SCRIPT_MALAYALAM,
|
||||
Mandaic => HB_SCRIPT_MANDAIC,
|
||||
Manichaean => HB_SCRIPT_MANICHAEAN,
|
||||
Marchen => HB_SCRIPT_MARCHEN,
|
||||
Masaram_Gondi => HB_SCRIPT_MASARAM_GONDI,
|
||||
Medefaidrin => HB_SCRIPT_MEDEFAIDRIN,
|
||||
Meetei_Mayek => HB_SCRIPT_MEETEI_MAYEK,
|
||||
Mende_Kikakui => HB_SCRIPT_MENDE_KIKAKUI,
|
||||
Meroitic_Cursive => HB_SCRIPT_MEROITIC_CURSIVE,
|
||||
Meroitic_Hieroglyphs => HB_SCRIPT_MEROITIC_HIEROGLYPHS,
|
||||
Miao => HB_SCRIPT_MIAO,
|
||||
Modi => HB_SCRIPT_MODI,
|
||||
Mongolian => HB_SCRIPT_MONGOLIAN,
|
||||
Mro => HB_SCRIPT_MRO,
|
||||
Multani => HB_SCRIPT_MULTANI,
|
||||
Myanmar => HB_SCRIPT_MYANMAR,
|
||||
Nabataean => HB_SCRIPT_NABATAEAN,
|
||||
Nandinagari => HB_SCRIPT_NANDINAGARI,
|
||||
New_Tai_Lue => HB_SCRIPT_NEW_TAI_LUE,
|
||||
Newa => HB_SCRIPT_NEWA,
|
||||
Nko => HB_SCRIPT_NKO,
|
||||
Nushu => HB_SCRIPT_NUSHU,
|
||||
Nyiakeng_Puachue_Hmong => HB_SCRIPT_NYIAKENG_PUACHUE_HMONG,
|
||||
Ogham => HB_SCRIPT_OGHAM,
|
||||
Ol_Chiki => HB_SCRIPT_OL_CHIKI,
|
||||
Old_Hungarian => HB_SCRIPT_OLD_HUNGARIAN,
|
||||
Old_Italic => HB_SCRIPT_OLD_ITALIC,
|
||||
Old_North_Arabian => HB_SCRIPT_OLD_NORTH_ARABIAN,
|
||||
Old_Permic => HB_SCRIPT_OLD_PERMIC,
|
||||
Old_Persian => HB_SCRIPT_OLD_PERSIAN,
|
||||
Old_Sogdian => HB_SCRIPT_OLD_SOGDIAN,
|
||||
Old_South_Arabian => HB_SCRIPT_OLD_SOUTH_ARABIAN,
|
||||
Old_Turkic => HB_SCRIPT_OLD_TURKIC,
|
||||
Oriya => HB_SCRIPT_ORIYA,
|
||||
Osage => HB_SCRIPT_OSAGE,
|
||||
Osmanya => HB_SCRIPT_OSMANYA,
|
||||
Pahawh_Hmong => HB_SCRIPT_PAHAWH_HMONG,
|
||||
Palmyrene => HB_SCRIPT_PALMYRENE,
|
||||
Pau_Cin_Hau => HB_SCRIPT_PAU_CIN_HAU,
|
||||
Phags_Pa => HB_SCRIPT_PHAGS_PA,
|
||||
Phoenician => HB_SCRIPT_PHOENICIAN,
|
||||
Psalter_Pahlavi => HB_SCRIPT_PSALTER_PAHLAVI,
|
||||
Rejang => HB_SCRIPT_REJANG,
|
||||
Runic => HB_SCRIPT_RUNIC,
|
||||
Samaritan => HB_SCRIPT_SAMARITAN,
|
||||
Saurashtra => HB_SCRIPT_SAURASHTRA,
|
||||
Sharada => HB_SCRIPT_SHARADA,
|
||||
Shavian => HB_SCRIPT_SHAVIAN,
|
||||
Siddham => HB_SCRIPT_SIDDHAM,
|
||||
SignWriting => HB_SCRIPT_SIGNWRITING,
|
||||
Sinhala => HB_SCRIPT_SINHALA,
|
||||
Sogdian => HB_SCRIPT_SOGDIAN,
|
||||
Sora_Sompeng => HB_SCRIPT_SORA_SOMPENG,
|
||||
Soyombo => HB_SCRIPT_SOYOMBO,
|
||||
Sundanese => HB_SCRIPT_SUNDANESE,
|
||||
Syloti_Nagri => HB_SCRIPT_SYLOTI_NAGRI,
|
||||
Syriac => HB_SCRIPT_SYRIAC,
|
||||
Tagalog => HB_SCRIPT_TAGALOG,
|
||||
Tagbanwa => HB_SCRIPT_TAGBANWA,
|
||||
Tai_Le => HB_SCRIPT_TAI_LE,
|
||||
Tai_Tham => HB_SCRIPT_TAI_THAM,
|
||||
Tai_Viet => HB_SCRIPT_TAI_VIET,
|
||||
Takri => HB_SCRIPT_TAKRI,
|
||||
Tamil => HB_SCRIPT_TAMIL,
|
||||
Tangut => HB_SCRIPT_TANGUT,
|
||||
Telugu => HB_SCRIPT_TELUGU,
|
||||
Thaana => HB_SCRIPT_THAANA,
|
||||
Thai => HB_SCRIPT_THAI,
|
||||
Tibetan => HB_SCRIPT_TIBETAN,
|
||||
Tifinagh => HB_SCRIPT_TIFINAGH,
|
||||
Tirhuta => HB_SCRIPT_TIRHUTA,
|
||||
Ugaritic => HB_SCRIPT_UGARITIC,
|
||||
Unknown => HB_SCRIPT_UNKNOWN,
|
||||
Vai => HB_SCRIPT_VAI,
|
||||
Warang_Citi => HB_SCRIPT_WARANG_CITI,
|
||||
Wancho => HB_SCRIPT_WANCHO,
|
||||
Yezidi => HB_SCRIPT_YEZIDI,
|
||||
Yi => HB_SCRIPT_YI,
|
||||
Zanabazar_Square => HB_SCRIPT_ZANABAZAR_SQUARE,
|
||||
_ => HB_SCRIPT_UNKNOWN,
|
||||
}
|
||||
}
|
||||
|
||||
impl ShaperMethods for Shaper {
|
||||
/// Calculate the layout metrics associated with the given text when painted in a specific
|
||||
/// font.
|
||||
|
@ -206,7 +371,7 @@ impl ShaperMethods for Shaper {
|
|||
},
|
||||
);
|
||||
|
||||
hb_buffer_set_script(hb_buffer, options.script.to_hb_script());
|
||||
hb_buffer_set_script(hb_buffer, unicode_to_hb_script(options.script));
|
||||
|
||||
hb_buffer_add_utf8(
|
||||
hb_buffer,
|
||||
|
|
|
@ -29,7 +29,7 @@ use style::properties::ComputedValues;
|
|||
use style::values::generics::text::LineHeight;
|
||||
use style::values::specified::text::{TextTransform, TextTransformCase};
|
||||
use unicode_bidi as bidi;
|
||||
use unicode_script::{get_script, Script};
|
||||
use unicode_script::Script;
|
||||
use xi_unicode::LineBreakLeafIter;
|
||||
|
||||
/// Returns the concatenated text of a list of unscanned text fragments.
|
||||
|
@ -259,7 +259,7 @@ impl TextRunScanner {
|
|||
//
|
||||
// TODO: Special handling of paired punctuation characters.
|
||||
// http://www.unicode.org/reports/tr24/#Common
|
||||
let script = get_script(character);
|
||||
let script = Script::from(character);
|
||||
let compatible_script = is_compatible(script, run_info.script);
|
||||
if compatible_script && !is_specific(run_info.script) && is_specific(script)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue