Update png/harfbuzz, use prefixed symbol names.

This commit is contained in:
Glenn Watson 2015-01-12 14:17:58 +10:00
parent 3897547bc2
commit c8e3d13821
4 changed files with 77 additions and 74 deletions

View file

@ -13,32 +13,32 @@ use text::util::{float_to_fixed, fixed_to_float};
use geom::Point2D;
use harfbuzz::{HB_MEMORY_MODE_READONLY, HB_DIRECTION_LTR};
use harfbuzz::{hb_blob_create, hb_face_create_for_tables};
use harfbuzz::{RUST_hb_blob_create, RUST_hb_face_create_for_tables};
use harfbuzz::{hb_blob_t};
use harfbuzz::{hb_bool_t};
use harfbuzz::{hb_buffer_add_utf8};
use harfbuzz::{hb_buffer_destroy};
use harfbuzz::{hb_buffer_get_glyph_positions};
use harfbuzz::{hb_buffer_get_length};
use harfbuzz::{hb_buffer_set_direction};
use harfbuzz::{hb_face_destroy};
use harfbuzz::{RUST_hb_buffer_add_utf8};
use harfbuzz::{RUST_hb_buffer_destroy};
use harfbuzz::{RUST_hb_buffer_get_glyph_positions};
use harfbuzz::{RUST_hb_buffer_get_length};
use harfbuzz::{RUST_hb_buffer_set_direction};
use harfbuzz::{RUST_hb_face_destroy};
use harfbuzz::{hb_face_t, hb_font_t};
use harfbuzz::{hb_feature_t};
use harfbuzz::{hb_font_create};
use harfbuzz::{hb_font_destroy, hb_buffer_create};
use harfbuzz::{hb_font_funcs_create};
use harfbuzz::{hb_font_funcs_destroy};
use harfbuzz::{hb_font_funcs_set_glyph_func};
use harfbuzz::{hb_font_funcs_set_glyph_h_advance_func};
use harfbuzz::{hb_font_funcs_set_glyph_h_kerning_func};
use harfbuzz::{RUST_hb_font_create};
use harfbuzz::{RUST_hb_font_destroy, RUST_hb_buffer_create};
use harfbuzz::{RUST_hb_font_funcs_create};
use harfbuzz::{RUST_hb_font_funcs_destroy};
use harfbuzz::{RUST_hb_font_funcs_set_glyph_func};
use harfbuzz::{RUST_hb_font_funcs_set_glyph_h_advance_func};
use harfbuzz::{RUST_hb_font_funcs_set_glyph_h_kerning_func};
use harfbuzz::{hb_font_funcs_t, hb_buffer_t, hb_codepoint_t};
use harfbuzz::{hb_font_set_funcs};
use harfbuzz::{hb_font_set_ppem};
use harfbuzz::{hb_font_set_scale};
use harfbuzz::{RUST_hb_font_set_funcs};
use harfbuzz::{RUST_hb_font_set_ppem};
use harfbuzz::{RUST_hb_font_set_scale};
use harfbuzz::{hb_glyph_info_t};
use harfbuzz::{hb_glyph_position_t};
use harfbuzz::{hb_position_t, hb_tag_t};
use harfbuzz::{hb_shape, hb_buffer_get_glyph_infos};
use harfbuzz::{RUST_hb_shape, RUST_hb_buffer_get_glyph_infos};
use libc::{c_uint, c_int, c_void, c_char};
use servo_util::geometry::Au;
use servo_util::range::Range;
@ -71,11 +71,11 @@ impl ShapedGlyphData {
pub fn new(buffer: *mut hb_buffer_t) -> ShapedGlyphData {
unsafe {
let mut glyph_count = 0;
let glyph_infos = hb_buffer_get_glyph_infos(buffer, &mut glyph_count);
let glyph_infos = RUST_hb_buffer_get_glyph_infos(buffer, &mut glyph_count);
let glyph_count = glyph_count as int;
assert!(glyph_infos.is_not_null());
let mut pos_count = 0;
let pos_infos = hb_buffer_get_glyph_positions(buffer, &mut pos_count);
let pos_infos = RUST_hb_buffer_get_glyph_positions(buffer, &mut pos_count);
let pos_count = pos_count as int;
assert!(pos_infos.is_not_null());
assert!(glyph_count == pos_count);
@ -156,13 +156,13 @@ impl Drop for Shaper {
fn drop(&mut self) {
unsafe {
assert!(self.hb_face.is_not_null());
hb_face_destroy(self.hb_face);
RUST_hb_face_destroy(self.hb_face);
assert!(self.hb_font.is_not_null());
hb_font_destroy(self.hb_font);
RUST_hb_font_destroy(self.hb_font);
assert!(self.hb_funcs.is_not_null());
hb_font_funcs_destroy(self.hb_funcs);
RUST_hb_font_funcs_destroy(self.hb_funcs);
}
}
}
@ -175,29 +175,29 @@ impl Shaper {
options: *options,
};
let hb_face: *mut hb_face_t =
hb_face_create_for_tables(get_font_table_func,
RUST_hb_face_create_for_tables(get_font_table_func,
(&mut *font_and_shaping_options)
as *mut FontAndShapingOptions
as *mut c_void,
None);
let hb_font: *mut hb_font_t = hb_font_create(hb_face);
let hb_font: *mut hb_font_t = RUST_hb_font_create(hb_face);
// Set points-per-em. if zero, performs no hinting in that direction.
let pt_size = font.actual_pt_size.to_subpx();
hb_font_set_ppem(hb_font, pt_size as c_uint, pt_size as c_uint);
RUST_hb_font_set_ppem(hb_font, pt_size as c_uint, pt_size as c_uint);
// Set scaling. Note that this takes 16.16 fixed point.
hb_font_set_scale(hb_font,
RUST_hb_font_set_scale(hb_font,
Shaper::float_to_fixed(pt_size) as c_int,
Shaper::float_to_fixed(pt_size) as c_int);
// configure static function callbacks.
// NB. This funcs structure could be reused globally, as it never changes.
let hb_funcs: *mut hb_font_funcs_t = hb_font_funcs_create();
hb_font_funcs_set_glyph_func(hb_funcs, glyph_func, ptr::null_mut(), None);
hb_font_funcs_set_glyph_h_advance_func(hb_funcs, glyph_h_advance_func, ptr::null_mut(), None);
hb_font_funcs_set_glyph_h_kerning_func(hb_funcs, glyph_h_kerning_func, ptr::null_mut(), ptr::null_mut());
hb_font_set_funcs(hb_font, hb_funcs, font as *mut Font as *mut c_void, None);
let hb_funcs: *mut hb_font_funcs_t = RUST_hb_font_funcs_create();
RUST_hb_font_funcs_set_glyph_func(hb_funcs, glyph_func, ptr::null_mut(), None);
RUST_hb_font_funcs_set_glyph_h_advance_func(hb_funcs, glyph_h_advance_func, ptr::null_mut(), None);
RUST_hb_font_funcs_set_glyph_h_kerning_func(hb_funcs, glyph_h_kerning_func, ptr::null_mut(), ptr::null_mut());
RUST_hb_font_set_funcs(hb_font, hb_funcs, font as *mut Font as *mut c_void, None);
Shaper {
hb_face: hb_face,
@ -226,10 +226,10 @@ impl ShaperMethods for Shaper {
/// font.
fn shape_text(&self, text: &str, options: &ShapingOptions, glyphs: &mut GlyphStore) {
unsafe {
let hb_buffer: *mut hb_buffer_t = hb_buffer_create();
hb_buffer_set_direction(hb_buffer, HB_DIRECTION_LTR);
let hb_buffer: *mut hb_buffer_t = RUST_hb_buffer_create();
RUST_hb_buffer_set_direction(hb_buffer, HB_DIRECTION_LTR);
hb_buffer_add_utf8(hb_buffer,
RUST_hb_buffer_add_utf8(hb_buffer,
text.as_ptr() as *const c_char,
text.len() as c_int,
0,
@ -241,7 +241,7 @@ impl ShaperMethods for Shaper {
_tag: LIGA,
_value: 0,
_start: 0,
_end: hb_buffer_get_length(hb_buffer),
_end: RUST_hb_buffer_get_length(hb_buffer),
})
}
if options.flags.contains(DISABLE_KERNING_SHAPING_FLAG) {
@ -249,13 +249,13 @@ impl ShaperMethods for Shaper {
_tag: KERN,
_value: 0,
_start: 0,
_end: hb_buffer_get_length(hb_buffer),
_end: RUST_hb_buffer_get_length(hb_buffer),
})
}
hb_shape(self.hb_font, hb_buffer, features.as_mut_ptr(), features.len() as u32);
RUST_hb_shape(self.hb_font, hb_buffer, features.as_mut_ptr(), features.len() as u32);
self.save_glyph_results(text, options, glyphs, hb_buffer);
hb_buffer_destroy(hb_buffer);
RUST_hb_buffer_destroy(hb_buffer);
}
}
}
@ -593,7 +593,7 @@ extern fn get_font_table_func(_: *mut hb_face_t,
let mut blob: *mut hb_blob_t = ptr::null_mut();
(*skinny_font_table_ptr).with_buffer(|buf: *const u8, len: uint| {
// HarfBuzz calls `destroy_blob_func` when the buffer is no longer needed.
blob = hb_blob_create(buf as *const c_char,
blob = RUST_hb_blob_create(buf as *const c_char,
len as c_uint,
HB_MEMORY_MODE_READONLY,
mem::transmute(skinny_font_table_ptr),

View file

@ -242,8 +242,8 @@ source = "git+https://github.com/servo/libfreetype2#f5c49c0da1d5bc6b206c41763440
[[package]]
name = "gcc"
version = "0.0.2"
source = "git+https://github.com/alexcrichton/gcc-rs#903e8f8a2e3766ad3d514404d452dbaa1d3b2d79"
version = "0.1.1"
source = "git+https://github.com/alexcrichton/gcc-rs#dfe97a119af4b2db53178eb8c3ca6be6589a152b"
[[package]]
name = "gcc"
@ -371,7 +371,7 @@ dependencies = [
[[package]]
name = "harfbuzz"
version = "0.1.0"
source = "git+https://github.com/servo/rust-harfbuzz#8aab215463214647b7a81f66011da552bbb1121c"
source = "git+https://github.com/servo/rust-harfbuzz#0489e7da24497f9ec17255fa72b90d6072f0c6d8"
[[package]]
name = "html5ever"
@ -582,15 +582,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "png"
version = "0.1.0"
source = "git+https://github.com/servo/rust-png#f060a2d9484a150de286f930eb80f9f3bff3ea38"
source = "git+https://github.com/servo/rust-png#cc1976df347bb21ac78c5b37e651b85878855991"
dependencies = [
"png-sys 1.6.3 (git+https://github.com/servo/libpng?ref=servo)",
"gcc 0.1.1 (git+https://github.com/alexcrichton/gcc-rs)",
"png-sys 1.6.16 (git+https://github.com/servo/rust-png)",
]
[[package]]
name = "png-sys"
version = "1.6.3"
source = "git+https://github.com/servo/libpng?ref=servo#d01f32b4eb86904695efe7fc02b574f902e21a98"
version = "1.6.16"
source = "git+https://github.com/servo/rust-png#cc1976df347bb21ac78c5b37e651b85878855991"
[[package]]
name = "script"
@ -699,7 +700,7 @@ name = "time"
version = "0.1.0"
source = "git+https://github.com/rust-lang/time#afab521f3b91658a3ba2d3e877b7e01699733bef"
dependencies = [
"gcc 0.0.2 (git+https://github.com/alexcrichton/gcc-rs)",
"gcc 0.1.1 (git+https://github.com/alexcrichton/gcc-rs)",
]
[[package]]

17
ports/cef/Cargo.lock generated
View file

@ -238,8 +238,8 @@ source = "git+https://github.com/servo/libfreetype2#f5c49c0da1d5bc6b206c41763440
[[package]]
name = "gcc"
version = "0.0.2"
source = "git+https://github.com/alexcrichton/gcc-rs#903e8f8a2e3766ad3d514404d452dbaa1d3b2d79"
version = "0.1.1"
source = "git+https://github.com/alexcrichton/gcc-rs#dfe97a119af4b2db53178eb8c3ca6be6589a152b"
[[package]]
name = "gcc"
@ -339,7 +339,7 @@ dependencies = [
[[package]]
name = "harfbuzz"
version = "0.1.0"
source = "git+https://github.com/servo/rust-harfbuzz#8aab215463214647b7a81f66011da552bbb1121c"
source = "git+https://github.com/servo/rust-harfbuzz#0489e7da24497f9ec17255fa72b90d6072f0c6d8"
[[package]]
name = "html5ever"
@ -550,15 +550,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "png"
version = "0.1.0"
source = "git+https://github.com/servo/rust-png#f060a2d9484a150de286f930eb80f9f3bff3ea38"
source = "git+https://github.com/servo/rust-png#cc1976df347bb21ac78c5b37e651b85878855991"
dependencies = [
"png-sys 1.6.3 (git+https://github.com/servo/libpng?ref=servo)",
"gcc 0.1.1 (git+https://github.com/alexcrichton/gcc-rs)",
"png-sys 1.6.16 (git+https://github.com/servo/rust-png)",
]
[[package]]
name = "png-sys"
version = "1.6.3"
source = "git+https://github.com/servo/libpng?ref=servo#d01f32b4eb86904695efe7fc02b574f902e21a98"
version = "1.6.16"
source = "git+https://github.com/servo/rust-png#cc1976df347bb21ac78c5b37e651b85878855991"
[[package]]
name = "script"
@ -683,7 +684,7 @@ name = "time"
version = "0.1.0"
source = "git+https://github.com/rust-lang/time#afab521f3b91658a3ba2d3e877b7e01699733bef"
dependencies = [
"gcc 0.0.2 (git+https://github.com/alexcrichton/gcc-rs)",
"gcc 0.1.1 (git+https://github.com/alexcrichton/gcc-rs)",
]
[[package]]

17
ports/gonk/Cargo.lock generated
View file

@ -221,8 +221,8 @@ source = "git+https://github.com/servo/libfreetype2#f5c49c0da1d5bc6b206c41763440
[[package]]
name = "gcc"
version = "0.0.2"
source = "git+https://github.com/alexcrichton/gcc-rs#903e8f8a2e3766ad3d514404d452dbaa1d3b2d79"
version = "0.1.1"
source = "git+https://github.com/alexcrichton/gcc-rs#dfe97a119af4b2db53178eb8c3ca6be6589a152b"
[[package]]
name = "gcc"
@ -293,7 +293,7 @@ dependencies = [
[[package]]
name = "harfbuzz"
version = "0.1.0"
source = "git+https://github.com/servo/rust-harfbuzz#8aab215463214647b7a81f66011da552bbb1121c"
source = "git+https://github.com/servo/rust-harfbuzz#0489e7da24497f9ec17255fa72b90d6072f0c6d8"
[[package]]
name = "html5ever"
@ -504,15 +504,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "png"
version = "0.1.0"
source = "git+https://github.com/servo/rust-png#f060a2d9484a150de286f930eb80f9f3bff3ea38"
source = "git+https://github.com/servo/rust-png#cc1976df347bb21ac78c5b37e651b85878855991"
dependencies = [
"png-sys 1.6.3 (git+https://github.com/servo/libpng?ref=servo)",
"gcc 0.1.1 (git+https://github.com/alexcrichton/gcc-rs)",
"png-sys 1.6.16 (git+https://github.com/servo/rust-png)",
]
[[package]]
name = "png-sys"
version = "1.6.3"
source = "git+https://github.com/servo/libpng?ref=servo#d01f32b4eb86904695efe7fc02b574f902e21a98"
version = "1.6.16"
source = "git+https://github.com/servo/rust-png#cc1976df347bb21ac78c5b37e651b85878855991"
[[package]]
name = "script"
@ -631,7 +632,7 @@ name = "time"
version = "0.1.0"
source = "git+https://github.com/rust-lang/time#afab521f3b91658a3ba2d3e877b7e01699733bef"
dependencies = [
"gcc 0.0.2 (git+https://github.com/alexcrichton/gcc-rs)",
"gcc 0.1.1 (git+https://github.com/alexcrichton/gcc-rs)",
]
[[package]]