mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Split freetype bindings into rust-freetype submodule.
This commit is contained in:
parent
962e0c6c27
commit
9bde1e9f26
7 changed files with 34 additions and 10 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -67,3 +67,6 @@
|
||||||
[submodule "src/rust-core-text"]
|
[submodule "src/rust-core-text"]
|
||||||
path = src/rust-core-text
|
path = src/rust-core-text
|
||||||
url = git://github.com/mozilla-servo/rust-core-text.git
|
url = git://github.com/mozilla-servo/rust-core-text.git
|
||||||
|
[submodule "src/rust-freetype"]
|
||||||
|
path = src/rust-freetype
|
||||||
|
url = git://github.com/mozilla-servo/rust-freetype.git
|
||||||
|
|
5
configure
vendored
5
configure
vendored
|
@ -351,6 +351,11 @@ then
|
||||||
CFG_SUBMODULES="rust-cocoa rust-io-surface rust-core-foundation rust-core-graphics rust-core-text ${CFG_SUBMODULES}"
|
CFG_SUBMODULES="rust-cocoa rust-io-surface rust-core-foundation rust-core-graphics rust-core-text ${CFG_SUBMODULES}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $CFG_OSTYPE = "linux" ]
|
||||||
|
then
|
||||||
|
CFG_SUBMODULES="rust-freetype ${CFG_SUBMODULES}"
|
||||||
|
fi
|
||||||
|
|
||||||
step_msg "making build directories"
|
step_msg "making build directories"
|
||||||
|
|
||||||
cd "${CFG_BUILD_DIR}"
|
cd "${CFG_BUILD_DIR}"
|
||||||
|
|
16
mk/sub.mk
16
mk/sub.mk
|
@ -1,3 +1,9 @@
|
||||||
|
# NOTE: the make magic can only compute transitive build dependencies,
|
||||||
|
# not transitive link flags. So, if A -> B -> C, must add A as a dep
|
||||||
|
# of C so the correct -L/path/to/A flag is generated for building C.
|
||||||
|
|
||||||
|
# NB. This should not be a problem once a real package system exists.
|
||||||
|
|
||||||
DEPS_rust-azure += \
|
DEPS_rust-azure += \
|
||||||
rust-geom
|
rust-geom
|
||||||
|
|
||||||
|
@ -60,3 +66,13 @@ DEPS_rust-core-text += \
|
||||||
rust-core-foundation \
|
rust-core-foundation \
|
||||||
rust-core-graphics
|
rust-core-graphics
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CFG_OSTYPE),linux)
|
||||||
|
DEPS_rust-azure += \
|
||||||
|
rust-freetype
|
||||||
|
|
||||||
|
# See note at top of file
|
||||||
|
DEPS_rust-layers += \
|
||||||
|
rust-freetype
|
||||||
|
|
||||||
|
endif
|
|
@ -1 +1 @@
|
||||||
Subproject commit 702a173e7b2f0fa61a47205bd79da30d5522bfa8
|
Subproject commit ec3f31b7f360d2f78343aec074b700ff2c8c3b3d
|
1
src/rust-freetype
Submodule
1
src/rust-freetype
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit a524e86e58020b9a5d7832f87fa90988703d1e0a
|
|
@ -1,4 +1,5 @@
|
||||||
export FontCache, native;
|
extern mod freetype;
|
||||||
|
|
||||||
use font::{Font, test_font_bin};
|
use font::{Font, test_font_bin};
|
||||||
|
|
||||||
struct FontCache {
|
struct FontCache {
|
||||||
|
@ -50,7 +51,6 @@ fn create_font(lib: @FontCache, native_lib: &native::NativeFontCache) -> Result<
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
pub mod native {
|
pub mod native {
|
||||||
use ptr::{null, addr_of};
|
use ptr::{null, addr_of};
|
||||||
use azure::freetype;
|
|
||||||
use freetype::{FT_Library, FT_Error};
|
use freetype::{FT_Library, FT_Error};
|
||||||
use freetype::bindgen::{FT_Init_FreeType, FT_Done_FreeType};
|
use freetype::bindgen::{FT_Init_FreeType, FT_Done_FreeType};
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#[legacy_exports];
|
|
||||||
export FreeTypeNativeFont, with_test_native_font, create;
|
extern mod freetype;
|
||||||
|
|
||||||
use font::{FontMetrics, FractionalPixel};
|
use font::{FontMetrics, FractionalPixel};
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ use ptr::{addr_of, null};
|
||||||
use cast::reinterpret_cast;
|
use cast::reinterpret_cast;
|
||||||
use glyph::GlyphIndex;
|
use glyph::GlyphIndex;
|
||||||
use font::FontMetrics;
|
use font::FontMetrics;
|
||||||
use azure::freetype;
|
|
||||||
use freetype::{ FT_Error, FT_Library, FT_Face, FT_Long, FT_ULong, FT_Size, FT_SizeRec,
|
use freetype::{ FT_Error, FT_Library, FT_Face, FT_Long, FT_ULong, FT_Size, FT_SizeRec,
|
||||||
FT_UInt, FT_GlyphSlot, FT_Size_Metrics, FT_FaceRec };
|
FT_UInt, FT_GlyphSlot, FT_Size_Metrics, FT_FaceRec };
|
||||||
use freetype::bindgen::{
|
use freetype::bindgen::{
|
||||||
|
@ -32,7 +31,7 @@ fn fixed_to_float_ft(f: i32) -> float {
|
||||||
fixed_to_float(6, f)
|
fixed_to_float(6, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct FreeTypeNativeFont {
|
pub struct FreeTypeNativeFont {
|
||||||
/// The font binary. This must stay valid for the lifetime of the font
|
/// The font binary. This must stay valid for the lifetime of the font
|
||||||
buf: @~[u8],
|
buf: @~[u8],
|
||||||
face: FT_Face,
|
face: FT_Face,
|
||||||
|
@ -45,12 +44,12 @@ struct FreeTypeNativeFont {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn FreeTypeNativeFont(face: FT_Face, buf: @~[u8]) -> FreeTypeNativeFont {
|
pub fn FreeTypeNativeFont(face: FT_Face, buf: @~[u8]) -> FreeTypeNativeFont {
|
||||||
assert face.is_not_null();
|
assert face.is_not_null();
|
||||||
FreeTypeNativeFont { buf: buf, face: face }
|
FreeTypeNativeFont { buf: buf, face: face }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FreeTypeNativeFont {
|
pub impl FreeTypeNativeFont {
|
||||||
|
|
||||||
fn glyph_index(codepoint: char) -> Option<GlyphIndex> {
|
fn glyph_index(codepoint: char) -> Option<GlyphIndex> {
|
||||||
assert self.face.is_not_null();
|
assert self.face.is_not_null();
|
||||||
|
@ -155,7 +154,7 @@ impl FT_Error : FTErrorMethods {
|
||||||
fn succeeded() -> bool { self == 0 as FT_Error }
|
fn succeeded() -> bool { self == 0 as FT_Error }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn with_test_native_font(f: fn@(nf: &NativeFont)) {
|
pub fn with_test_native_font(f: fn@(nf: &NativeFont)) {
|
||||||
use font::test_font_bin;
|
use font::test_font_bin;
|
||||||
use unwrap_result = result::unwrap;
|
use unwrap_result = result::unwrap;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue