mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Remove src/servo/text and move things to gfx/ and util/. Add a convenience gfx.rs redirector. Closes #171.
This commit is contained in:
parent
2daa422483
commit
b01979e816
27 changed files with 133 additions and 197 deletions
23
src/servo/gfx.rs
Normal file
23
src/servo/gfx.rs
Normal file
|
@ -0,0 +1,23 @@
|
|||
/* This file exists just to make it easier to import things inside of
|
||||
./gfx/ without specifying the file they came out of imports.
|
||||
|
||||
Note that you still must define each of the files as a module in
|
||||
servo.rc. This is not ideal and may be changed in the future. */
|
||||
|
||||
// shortcut names
|
||||
pub use au = geometry;
|
||||
pub use dl = display_list;
|
||||
|
||||
pub use display_list::DisplayList;
|
||||
pub use font::Font;
|
||||
pub use font_cache::FontCache;
|
||||
pub use font_context::FontContext;
|
||||
pub use font_matcher::FontMatcher;
|
||||
pub use geometry::Au;
|
||||
pub use native_font::NativeFont;
|
||||
pub use shaper::Shaper;
|
||||
pub use text_run::TextRun;
|
||||
pub use text_run::SendableTextRun;
|
||||
|
||||
pub use render_context::RenderContext;
|
||||
pub use render_layers::RenderLayer;
|
|
@ -3,10 +3,9 @@ use au = gfx::geometry;
|
|||
use au::Au;
|
||||
use geom::rect::Rect;
|
||||
use geom::point::Point2D;
|
||||
use gfx::SendableTextRun;
|
||||
use image::base::Image;
|
||||
use render_context::RenderContext;
|
||||
use servo_text::text_run;
|
||||
use text::text_run::SendableTextRun;
|
||||
use util::range::Range;
|
||||
use color::{Color, rgb};
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
pub use font_cache::FontCache;
|
||||
|
||||
use au = gfx::geometry;
|
||||
use au::Au;
|
||||
use azure::{
|
||||
|
@ -7,15 +5,12 @@ use azure::{
|
|||
AzScaledFontRef,
|
||||
};
|
||||
use core::dvec::DVec;
|
||||
use gfx::render_context::RenderContext;
|
||||
use gfx::RenderContext;
|
||||
use geom::point::Point2D;
|
||||
use geom::rect::Rect;
|
||||
use geom::size::Size2D;
|
||||
use glyph::{GlyphStore, GlyphIndex};
|
||||
use native_font::NativeFont;
|
||||
use servo_util::range::Range;
|
||||
use shaper::Shaper;
|
||||
use text::text_run::TextRun;
|
||||
|
||||
// Used to abstract over the shaper's choice of fixed int representation.
|
||||
type FractionalPixel = float;
|
|
@ -1,17 +1,20 @@
|
|||
extern mod harfbuzz;
|
||||
|
||||
use font::Font;
|
||||
use font_cache::FontCache;
|
||||
use gfx::{
|
||||
au,
|
||||
|
||||
Au,
|
||||
Font,
|
||||
FontCache,
|
||||
};
|
||||
|
||||
use au = gfx::geometry;
|
||||
use au::Au;
|
||||
use geom::point::Point2D;
|
||||
use glyph::{GlyphStore, GlyphIndex, GlyphData};
|
||||
use libc::types::common::c99::int32_t;
|
||||
use libc::{c_uint, c_int, c_void, c_char};
|
||||
use ptr::{null, to_unsafe_ptr, offset};
|
||||
use std::arc;
|
||||
use util::*;
|
||||
use util = util::text;
|
||||
|
||||
use harfbuzz::{HB_MEMORY_MODE_READONLY,
|
||||
HB_DIRECTION_LTR};
|
|
@ -1,9 +1,10 @@
|
|||
use au = geometry;
|
||||
|
||||
use compositor::LayerBuffer;
|
||||
use text::font::Font;
|
||||
use text::text_run::TextRun;
|
||||
use text::font_cache::FontCache;
|
||||
use gfx::{
|
||||
Font,
|
||||
FontCache,
|
||||
TextRun,
|
||||
};
|
||||
use image::base::Image;
|
||||
use au::Au;
|
||||
use util::range::Range;
|
||||
|
|
|
@ -1,21 +1,27 @@
|
|||
use au = gfx::geometry;
|
||||
use au::Au;
|
||||
use azure::AzFloat;
|
||||
use comm::*;
|
||||
use compositor::{Compositor, LayerBufferSet};
|
||||
use dl = display_list;
|
||||
use geom::matrix2d::Matrix2D;
|
||||
use gfx::render_layers::RenderLayer;
|
||||
use libc::size_t;
|
||||
use libc::types::common::c99::uint16_t;
|
||||
use mod gfx::render_layers;
|
||||
use pipes::{Port, Chan};
|
||||
use platform::osmain;
|
||||
use render_context::RenderContext;
|
||||
use render_layers::render_layers;
|
||||
use std::cell::Cell;
|
||||
use text::font_cache::FontCache;
|
||||
use text::font_context::FontContext;
|
||||
|
||||
use azure::AzFloat;
|
||||
use geom::matrix2d::Matrix2D;
|
||||
|
||||
use dl = display_list;
|
||||
use gfx::{
|
||||
FontCache,
|
||||
FontContext,
|
||||
RenderContext,
|
||||
RenderLayer,
|
||||
};
|
||||
use gfx::compositor::{
|
||||
Compositor,
|
||||
LayerBufferSet,
|
||||
};
|
||||
use mod gfx::render_layers;
|
||||
use platform::osmain;
|
||||
use render_layers::render_layers;
|
||||
|
||||
|
||||
pub enum Msg {
|
||||
RenderMsg(RenderLayer),
|
||||
|
|
|
@ -40,8 +40,6 @@ impl SendableTextRun {
|
|||
|
||||
impl TextRun {
|
||||
static fn new(font: @Font, text: ~str) -> TextRun {
|
||||
use shaper::Shaper;
|
||||
|
||||
let glyph_store = font.shape_text(text);
|
||||
let run = TextRun {
|
||||
text: move text,
|
|
@ -25,8 +25,7 @@ use layout::context::LayoutContext;
|
|||
use layout::debug::BoxedDebugMethods;
|
||||
use layout::flow::FlowContext;
|
||||
use layout::text::TextBoxData;
|
||||
use servo_text::text_run;
|
||||
use servo_text::text_run::TextRun;
|
||||
use gfx::TextRun;
|
||||
use std::net::url::Url;
|
||||
use task::spawn;
|
||||
use util::range::*;
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
use resource::local_image_cache::LocalImageCache;
|
||||
use servo_text::font_cache::FontCache;
|
||||
use std::net::url::Url;
|
||||
use geom::rect::Rect;
|
||||
use gfx::geometry::Au;
|
||||
use gfx::{
|
||||
Au,
|
||||
FontCache,
|
||||
};
|
||||
use resource::local_image_cache::LocalImageCache;
|
||||
use std::net::url::Url;
|
||||
|
||||
/* Represents layout task context. */
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ use layout::box::{RenderBox, TextBox};
|
|||
use layout::context::LayoutContext;
|
||||
use layout::flow::FlowContext;
|
||||
use layout::text::TextBoxData;
|
||||
use servo_text::text_run::TextRun;
|
||||
use util::tree;
|
||||
use vec::push;
|
||||
|
||||
|
|
|
@ -13,10 +13,9 @@ use layout::context::LayoutContext;
|
|||
use layout::flow::{FlowContext, InlineFlow};
|
||||
use layout::text::TextBoxData;
|
||||
use num::Num;
|
||||
use servo_text::text_run::TextRun;
|
||||
use servo_text::util::*;
|
||||
use std::arc;
|
||||
use util::range::{MutableRange, Range};
|
||||
use util::text::*;
|
||||
use util::tree;
|
||||
|
||||
/*
|
||||
|
@ -270,7 +269,7 @@ impl TextRunScanner {
|
|||
// create the run, then make new boxes with the run and adjusted text indices
|
||||
|
||||
// TODO(Issue #116): use actual font for corresponding DOM node to create text run.
|
||||
let run = @TextRun::new(ctx.font_cache.get_test_font(), move run_str);
|
||||
let run = @gfx::TextRun::new(ctx.font_cache.get_test_font(), move run_str);
|
||||
debug!("TextRunScanner: pushing box(es) in range: %?", self.clump);
|
||||
for self.clump.eachi |i| {
|
||||
let range = new_ranges[i - self.clump.begin()];
|
||||
|
|
|
@ -3,20 +3,24 @@
|
|||
rendered.
|
||||
*/
|
||||
|
||||
use au = gfx::geometry;
|
||||
use au::Au;
|
||||
use content::content_task;
|
||||
use core::dvec::DVec;
|
||||
use newcss::stylesheet::Stylesheet;
|
||||
use dl = gfx::display_list;
|
||||
use dom::event::{Event, ReflowEvent};
|
||||
use dom::node::{Node, LayoutData};
|
||||
use geom::point::Point2D;
|
||||
use geom::rect::Rect;
|
||||
use geom::size::Size2D;
|
||||
use gfx::display_list::DisplayList;
|
||||
use gfx::{
|
||||
au, dl,
|
||||
Au,
|
||||
DisplayList,
|
||||
FontCache,
|
||||
FontContext,
|
||||
FontMatcher,
|
||||
RenderLayer,
|
||||
};
|
||||
use gfx::render_task;
|
||||
use gfx::render_layers::RenderLayer;
|
||||
use layout::box::RenderBox;
|
||||
use layout::box_builder::LayoutTreeBuilder;
|
||||
use layout::context::LayoutContext;
|
||||
|
@ -24,9 +28,6 @@ use opt = core::option;
|
|||
use render_task::RenderTask;
|
||||
use resource::image_cache_task::{ImageCacheTask, ImageResponseMsg};
|
||||
use resource::local_image_cache::LocalImageCache;
|
||||
use servo_text::font_context::FontContext;
|
||||
use servo_text::font_cache::FontCache;
|
||||
use servo_text::font_matcher::FontMatcher;
|
||||
use std::arc::ARC;
|
||||
use std::net::url::Url;
|
||||
use core::util::replace;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** Text layout. */
|
||||
|
||||
use servo_text::text_run::TextRun;
|
||||
use gfx::TextRun;
|
||||
use layout::box::{TextBox, RenderBox, RenderBoxData, UnscannedTextBox};
|
||||
use util::range::Range;
|
||||
|
||||
|
|
|
@ -16,41 +16,42 @@ extern mod hubbub;
|
|||
extern mod js;
|
||||
extern mod layers;
|
||||
extern mod opengles;
|
||||
extern mod newcss (name = "css");
|
||||
extern mod sharegl;
|
||||
extern mod stb_image;
|
||||
extern mod std;
|
||||
extern mod newcss (name = "css");
|
||||
|
||||
pub mod engine;
|
||||
|
||||
pub mod dom {
|
||||
pub mod bindings {
|
||||
pub mod document;
|
||||
pub mod element;
|
||||
pub mod utils;
|
||||
pub mod node;
|
||||
pub mod window;
|
||||
}
|
||||
pub mod document;
|
||||
pub mod element;
|
||||
pub mod event;
|
||||
pub mod node;
|
||||
pub mod cow;
|
||||
pub mod window;
|
||||
}
|
||||
|
||||
pub mod content {
|
||||
pub mod content_task;
|
||||
}
|
||||
|
||||
pub mod css {
|
||||
pub mod node_style;
|
||||
pub mod matching;
|
||||
priv mod select_handler;
|
||||
priv mod node_util;
|
||||
priv mod node_void_ptr;
|
||||
|
||||
pub mod matching;
|
||||
pub mod node_style;
|
||||
}
|
||||
|
||||
pub mod dom {
|
||||
pub mod bindings {
|
||||
pub mod document;
|
||||
pub mod element;
|
||||
pub mod node;
|
||||
pub mod utils;
|
||||
pub mod window;
|
||||
}
|
||||
pub mod cow;
|
||||
pub mod document;
|
||||
pub mod element;
|
||||
pub mod event;
|
||||
pub mod node;
|
||||
pub mod window;
|
||||
}
|
||||
|
||||
pub mod engine;
|
||||
|
||||
pub mod layout {
|
||||
pub mod block;
|
||||
pub mod box;
|
||||
|
@ -68,48 +69,32 @@ pub mod layout {
|
|||
}
|
||||
|
||||
pub mod gfx {
|
||||
priv mod render_context;
|
||||
|
||||
// rendering
|
||||
pub mod color;
|
||||
pub mod geometry;
|
||||
pub mod surface;
|
||||
pub mod render_task;
|
||||
pub mod compositor;
|
||||
pub mod display_list;
|
||||
pub mod geometry;
|
||||
pub mod render_layers;
|
||||
priv mod render_context;
|
||||
}
|
||||
pub mod render_task;
|
||||
pub mod surface;
|
||||
|
||||
pub mod image {
|
||||
pub mod base;
|
||||
pub mod holder;
|
||||
pub mod encode {
|
||||
pub mod tga;
|
||||
}
|
||||
}
|
||||
|
||||
pub mod html {
|
||||
pub mod hubbub_html_parser;
|
||||
pub mod cssparse;
|
||||
}
|
||||
|
||||
pub mod platform {
|
||||
pub mod base;
|
||||
pub mod osmain;
|
||||
priv mod resize_rate_limiter;
|
||||
}
|
||||
|
||||
pub mod text {
|
||||
// fonts
|
||||
pub mod font;
|
||||
pub mod font_cache;
|
||||
pub mod font_matcher;
|
||||
pub mod glyph;
|
||||
pub mod text_run;
|
||||
pub mod util;
|
||||
|
||||
// platform and library-specific implementations.
|
||||
// Typedefs and pub-uses for multiple implementations. If prefixed
|
||||
// with 'native', then the specific implementataion is composed by
|
||||
// a non-prefixed version, listed above.
|
||||
pub mod font_context;
|
||||
pub mod native_font;
|
||||
pub mod shaper;
|
||||
|
||||
// Below are the actual platform-specific parts.
|
||||
pub mod harfbuzz {
|
||||
pub mod shaper;
|
||||
}
|
||||
|
@ -127,24 +112,43 @@ pub mod text {
|
|||
}
|
||||
}
|
||||
|
||||
pub mod image {
|
||||
pub mod base;
|
||||
pub mod encode {
|
||||
pub mod tga;
|
||||
}
|
||||
pub mod holder;
|
||||
}
|
||||
|
||||
pub mod html {
|
||||
pub mod cssparse;
|
||||
pub mod hubbub_html_parser;
|
||||
}
|
||||
|
||||
pub mod platform {
|
||||
pub mod base;
|
||||
pub mod osmain;
|
||||
priv mod resize_rate_limiter;
|
||||
}
|
||||
|
||||
pub mod resource {
|
||||
pub mod resource_task;
|
||||
pub mod file_loader;
|
||||
pub mod http_loader;
|
||||
pub mod image_cache_task;
|
||||
pub mod local_image_cache;
|
||||
pub mod resource_task;
|
||||
}
|
||||
|
||||
pub mod util {
|
||||
pub mod tree;
|
||||
pub mod actor;
|
||||
pub mod range;
|
||||
pub mod text;
|
||||
pub mod time;
|
||||
pub mod tree;
|
||||
pub mod url;
|
||||
pub mod vec;
|
||||
pub mod range;
|
||||
pub mod actor;
|
||||
}
|
||||
|
||||
pub mod opts;
|
||||
|
||||
use servo_util = util;
|
||||
use servo_text = text;
|
||||
|
|
Binary file not shown.
|
@ -1,93 +0,0 @@
|
|||
Copyright (c) 2009, 2010, 2011 Daniel Johnson (<il.basso.buffo@gmail.com>).
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
Loading…
Add table
Add a link
Reference in a new issue