Git Product home page Git Product logo

Comments (7)

berkus avatar berkus commented on July 30, 2024
Process 96665 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x00000001000131b4 render-glyph`font_kit::loaders::core_text::Font::typographic_bounds::he1e3ef41c5dc828f(self=0x000000016fdfeef8, glyph_id=48) at core_text.rs:354:27
   351 	            .core_text_font
   352 	            .get_bounding_rects_for_glyphs(kCTFontDefaultOrientation, &[glyph_id as u16]);
   353 	        let rect = RectF::new(
-> 354 	            Vector2F::new(rect.origin.x as f32, rect.origin.y as f32),
   355 	            Vector2F::new(rect.size.width as f32, rect.size.height as f32),
   356 	        );
   357 	        Ok(rect * self.units_per_point() as f32)
Target 0: (render-glyph) stopped.
(lldb) p rect
(core_graphics_types::geometry::CGRect) $4 = {
  origin = (x = 0.671875, y = 0)
  size = (width = 8.2734375, height = 11.6640625)
}

rect seems good after call to CTFontGetBoundingRectsForGlyphs (from .get_bounding_rects_for_glyphs)

from font-kit.

berkus avatar berkus commented on July 30, 2024

After running

let rect = RectF::new(
    Vector2F::new(rect.origin.x as f32, rect.origin.y as f32),
    Vector2F::new(rect.size.width as f32, rect.size.height as f32),
);

it becomes

Process 96665 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000100013224 render-glyph`font_kit::loaders::core_text::Font::typographic_bounds::he1e3ef41c5dc828f(self=0x000000016fdfeef8, glyph_id=48) at core_text.rs:357:19
   354 	            Vector2F::new(rect.origin.x as f32, rect.origin.y as f32),
   355 	            Vector2F::new(rect.size.width as f32, rect.size.height as f32),
   356 	        );
-> 357 	        Ok(rect * self.units_per_point() as f32)
   358 	    }
   359
   360 	    /// Returns the distance from the origin of the glyph with the given ID to the next, in font
Target 0: (render-glyph) stopped.
(lldb) p rect
(pathfinder_geometry::rect::RectF) $5 = {
  __0 = {
    __0 = (__0 = 0.671875, __1 = 0, __2 = 0.671875, __3 = 0)
  }
}

i.e. completely empty RectF.

from font-kit.

berkus avatar berkus commented on July 30, 2024

Origin and size are ok, but constructing RectF causes it to collapse (?)

origin:
CGPoint { x: 0.671875, y: 0.0 } vs Vector2F(<0.671875, 0>)
size:
CGSize { width: 8.2734375, height: 11.6640625 } vs Vector2F(<8.2734375, 11.6640625>)

result:
RectF(<0.671875, 0, 0.671875, 0>) and point size 128.0

this is all in

    /// Returns the boundaries of a glyph in font units.
    pub fn typographic_bounds(&self, glyph_id: u32) -> Result<RectF, GlyphLoadingError> {
        let rect = self
            .core_text_font
            .get_bounding_rects_for_glyphs(kCTFontDefaultOrientation, &[glyph_id as u16]);
        let origin =
            Vector2F::new(rect.origin.x as f32, rect.origin.y as f32);
        let size =
            Vector2F::new(rect.size.width as f32, rect.size.height as f32);
println!("{:?} vs {:?}", rect.origin, origin);
println!("{:?} vs {:?}", rect.size, size);
        let rect = RectF::new(origin, size);
println!("{:?} and point size {:?}", rect, self.units_per_point());
        Ok(rect * self.units_per_point() as f32)
    }

from font-kit.

berkus avatar berkus commented on July 30, 2024

Looks like the bug is in pathfinder_simd implementation - depending with features = ["pf-no-simd"] renders the glyph.

from font-kit.

berkus avatar berkus commented on July 30, 2024

Fix proposed servo/pathfinder#452

from font-kit.

berkus avatar berkus commented on July 30, 2024

^ merged, necessary to bump and release versions.

from font-kit.

berkus avatar berkus commented on July 30, 2024

pathfinder_simd has released 0.5.1 about two weeks ago, bump?

from font-kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.