servo / servo/font-kit

Readme example compile failed

Open
#167 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
840
Forks
137
Avg merge
4h 56m
Merged PRs (30d)
1

Description

use font_kit::{
    canvas::{Canvas, Format, RasterizationOptions},
    hinting::HintingOptions,
    source::SystemSource,
};

#[test]
fn main() {
    let font = SystemSource::new().select_by_postscript_name("ArialMT").unwrap().load().unwrap();

    let glyph_id = font.glyph_for_char('A').unwrap();
    let mut canvas = Canvas::new(&Size2D::new(32, 32), Format::A8);

    font.rasterize_glyph(
        &mut canvas,
        glyph_id,
        32.0,
        &Point2D::new(0.0, 32.0),
        HintingOptions::None,
        RasterizationOptions::GrayscaleAa,
    )
    .unwrap();
}

Size2D and Point2D is missing, while Transform2F and Vector2I does not reexported.

error[E0433]: failed to resolve: use of undeclared type or module `Size2D`
  --> projects\ascii-art-core\tests\main.rs:12:35
   |
12 |     let mut canvas = Canvas::new(&Size2D::new(32, 32), Format::A8);
   |                                   ^^^^^^ use of undeclared type or module `Size2D`

error[E0433]: failed to resolve: use of undeclared type or module `Point2D`
  --> projects\ascii-art-core\tests\main.rs:18:10
   |
18 |         &Point2D::new(0.0, 32.0),
   |          ^^^^^^^ use of undeclared type or module `Point2D`

error: aborting due to 2 previous errors

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by compiling the README Rust example, using the failure shown at projects\ascii-art-core\tests\main.rs as the entry point. Inspect the font_kit exports for Size2D, Point2D, Transform2F, and Vector2I, then verify that the corrected example compiles and the referenced types are available as intended.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.