aboutsummaryrefslogtreecommitdiffstats
path: root/components/gfx/platform/dummy/font.rs
blob: 096580c66db5d4059fd408872b26b96fa388a97b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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
    }
}