Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Native MSVC windows build, convert to cmake
- Loading branch information
Showing
17 changed files
with
394 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
use app_units::Au; | ||
use font::{FontHandleMethods, FontMetrics, FontTableMethods}; | ||
use font::{FontTableTag, FractionalPixel}; | ||
use platform::font_context::FontContextHandle; | ||
use platform::font_template::FontTemplateData; | ||
use std::sync::Arc; | ||
use style::computed_values::{font_stretch, font_weight}; | ||
use text::glyph::GlyphId; | ||
|
||
#[derive(Debug)] | ||
pub struct FontTable { | ||
buffer: Vec<u8>, | ||
} | ||
|
||
impl FontTableMethods for FontTable { | ||
fn buffer(&self) -> &[u8] { | ||
&self.buffer | ||
} | ||
} | ||
|
||
#[derive(Debug)] | ||
pub struct FontHandle { | ||
handle: FontContextHandle, | ||
} | ||
|
||
impl Drop for FontHandle { | ||
fn drop(&mut self) { | ||
} | ||
} | ||
|
||
impl FontHandleMethods for FontHandle { | ||
fn new_from_template(fctx: &FontContextHandle, | ||
template: Arc<FontTemplateData>, | ||
pt_size: Option<Au>) | ||
-> Result<FontHandle, ()> { | ||
Err(()) | ||
} | ||
|
||
fn template(&self) -> Arc<FontTemplateData> { | ||
unimplemented!() | ||
} | ||
fn family_name(&self) -> String { | ||
String::from("Unknown") | ||
} | ||
fn face_name(&self) -> String { | ||
String::from("Unknown") | ||
} | ||
fn is_italic(&self) -> bool { | ||
false | ||
} | ||
fn boldness(&self) -> font_weight::T { | ||
font_weight::T::Weight400 | ||
} | ||
fn stretchiness(&self) -> font_stretch::T { | ||
font_stretch::T::normal | ||
} | ||
fn glyph_index(&self, codepoint: char) -> Option<GlyphId> { | ||
None | ||
} | ||
fn glyph_h_kerning(&self, first_glyph: GlyphId, second_glyph: GlyphId) | ||
-> FractionalPixel { | ||
0.0 | ||
} | ||
fn can_do_fast_shaping(&self) -> bool { | ||
false | ||
} | ||
fn glyph_h_advance(&self, glyph: GlyphId) -> Option<FractionalPixel> { | ||
None | ||
} | ||
fn metrics(&self) -> FontMetrics { | ||
unimplemented!() | ||
} | ||
fn table_for_tag(&self, tag: FontTableTag) -> Option<FontTable> { | ||
None | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#[derive(Clone, HeapSizeOf, Debug)] | ||
pub struct FontContextHandle; | ||
|
||
impl FontContextHandle { | ||
pub fn new() -> FontContextHandle { | ||
FontContextHandle | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
pub fn for_each_available_family<F>(mut callback: F) where F: FnMut(String) | ||
{ | ||
} | ||
|
||
pub fn for_each_variation<F>(family_name: &str, mut callback: F) | ||
where F: FnMut(String) | ||
{ | ||
} | ||
|
||
pub fn system_default_family(generic_name: &str) -> Option<String> { | ||
None | ||
} | ||
|
||
pub fn last_resort_font_families() -> Vec<String> { | ||
vec!( | ||
"Unknown".to_owned() | ||
) | ||
} | ||
|
||
pub static SANS_SERIF_FONT_FAMILY: &'static str = "Unknown"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
use string_cache::Atom; | ||
use webrender_traits::NativeFontHandle; | ||
|
||
#[derive(Deserialize, Serialize, Debug)] | ||
pub struct FontTemplateData { | ||
pub bytes: Vec<u8>, | ||
pub identifier: Atom, | ||
} | ||
|
||
impl FontTemplateData { | ||
pub fn new(identifier: Atom, font_data: Option<Vec<u8>>) -> FontTemplateData { | ||
let bytes = match font_data { | ||
Some(bytes) => { | ||
bytes | ||
}, | ||
None => { | ||
unimplemented!() | ||
} | ||
}; | ||
|
||
FontTemplateData { | ||
bytes: bytes, | ||
identifier: identifier, | ||
} | ||
} | ||
pub fn bytes(&self) -> Vec<u8> { | ||
self.bytes.clone() | ||
} | ||
pub fn bytes_if_in_memory(&self) -> Option<Vec<u8>> { | ||
Some(self.bytes()) | ||
} | ||
pub fn native_font(&self) -> Option<NativeFontHandle> { | ||
None | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
project(script) | ||
cmake_minimum_required(VERSION 2.6) | ||
|
||
set(DUMMY ${CMAKE_BUILD_TYPE}) | ||
|
||
FUNCTION(PREPEND var prefix) | ||
SET(listVar "") | ||
FOREACH(f ${ARGN}) | ||
LIST(APPEND listVar "${prefix}/${f}") | ||
ENDFOREACH(f) | ||
SET(${var} "${listVar}" PARENT_SCOPE) | ||
ENDFUNCTION(PREPEND) | ||
|
||
set(bindings_src ${PROJECT_SOURCE_DIR}/dom/bindings/codegen) | ||
set(webidls_src ${PROJECT_SOURCE_DIR}/dom/webidls) | ||
|
||
# Without Bindings/* stuff, since we install that separately below | ||
set(globalgen_base_src | ||
PrototypeList.rs | ||
RegisterBindings.rs | ||
InterfaceObjectMap.rs | ||
InterfaceTypes.rs | ||
InheritTypes.rs | ||
UnionTypes.rs | ||
) | ||
|
||
set(globalgen_src | ||
${globalgen_base_src} | ||
Bindings/mod.rs | ||
) | ||
|
||
file(GLOB_RECURSE webidls ${webidls_src}/*.webidl) | ||
string(REGEX REPLACE ";" "\n" webidl_filelist "${webidls}") | ||
file(WRITE "${PROJECT_BINARY_DIR}/webidls.list" "${webidl_filelist}") | ||
string(REGEX REPLACE "\\.webidl(;|$)" "\\1" bindings "${webidls}") | ||
string(REGEX REPLACE "(^|;)${webidls_src}/" "\\1" bindings "${bindings}") | ||
|
||
set(globalgen_deps | ||
${bindings_src}/GlobalGen.py | ||
${bindings_src}/Bindings.conf | ||
${bindings_src}/Configuration.py | ||
${bindings_src}/CodegenRust.py | ||
${bindings_src}/parser/WebIDL.py | ||
) | ||
set(bindinggen_deps | ||
${bindings_src}/BindingGen.py | ||
${bindings_src}/Bindings.conf | ||
${bindings_src}/Configuration.py | ||
${bindings_src}/CodegenRust.py | ||
${bindings_src}/parser/WebIDL.py | ||
) | ||
|
||
add_custom_command( | ||
OUTPUT Bindings | ||
COMMAND ${CMAKE_COMMAND} -E make_directory Bindings | ||
) | ||
add_custom_command( | ||
OUTPUT _cache | ||
COMMAND ${CMAKE_COMMAND} -E make_directory _cache | ||
) | ||
|
||
add_custom_command( | ||
OUTPUT ParserResults.pkl | ||
COMMAND python -B ${bindings_src}/pythonpath.py -I ${bindings_src}/parser -I ${bindings_src}/ply | ||
${bindings_src}/GlobalGen.py | ||
--cachedir=_cache | ||
--filelist=webidls.list | ||
${bindings_src}/Bindings.conf | ||
. | ||
${PROJECT_SOURCE_DIR} | ||
DEPENDS Bindings _cache ${globalgen_deps} ${webidls} | ||
VERBATIM | ||
) | ||
|
||
# We need an intermediate custom target for this, due to this misfeature: | ||
# > If any dependency is an OUTPUT of another custom command in the same | ||
# > directory CMake automatically brings the other custom command into the | ||
# > target in which this command is built. | ||
# So, depending directly on ParserResults.pkl from the add_custom_command | ||
# below would cause GlobalGen.py to be executed each time. | ||
add_custom_target(ParserResults ALL DEPENDS ParserResults.pkl) | ||
add_custom_target(generate-bindings ALL) | ||
|
||
foreach(binding IN LISTS bindings) | ||
add_custom_command( | ||
OUTPUT Bindings/${binding}Binding.rs | ||
COMMAND python -B ${bindings_src}/pythonpath.py -I ${bindings_src}/parser -I ${bindings_src}/ply | ||
${bindings_src}/BindingGen.py | ||
${bindings_src}/Bindings.conf | ||
. | ||
Bindings/${binding}Binding | ||
${webidls_src}/${binding}.webidl | ||
DEPENDS Bindings ${bindinggen_deps} ${webidls_src}/${binding}.webidl ParserResults | ||
VERBATIM | ||
) | ||
add_custom_target(${binding} DEPENDS Bindings/${binding}Binding.rs) | ||
add_dependencies(generate-bindings ${binding}) | ||
endforeach() | ||
|
||
PREPEND(globalgen_out ${CMAKE_BINARY_DIR}/ ${globalgen_base_src}) | ||
install(FILES ${globalgen_out} DESTINATION .) | ||
install(DIRECTORY ${CMAKE_BINARY_DIR}/Bindings/ DESTINATION Bindings) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.