1

I have implemented IDWriteInlineObject interface to draw ID2D1Bitmap as inline object inside a text. Everything works fine except one: my implementation's GetOverhangMetrics method never get called.

I've also tried a sample from DirectWrite SDK samples (PadWrite Layout Sample, https://msdn.microsoft.com/en-us/library/windows/desktop/dd941792%28v=vs.85%29.aspx). And got the same result ('InlineImage::GetOverhangMetrics' in InlineImage.cpp is never called).

Therefore my question is why one's implementation of GetOverhangMetrics method never get called?

Ruslan Garipov
  • 530
  • 4
  • 13

2 Answers2

2

I admit I haven't tested this, so just a thought - I think it's possible it's called when you ask for overhang metrics of layout itself, so when layout method GetOverhangMetrics() is called it feels like it would accumulate not only regular text overhang boxes, but inline object boxes too.

bunglehead
  • 1,104
  • 1
  • 14
  • 22
  • Correct. The inline objects are part of the overall bounding box, and so when an app first calls IDWriteTextLayout::GetOverhangMetrics, the layout calls IDWriteInlineImage::GetOverhangMetrics for every inline object and IDWriteFontFace::GetGlyphMetrics for every text run. – Dwayne Robinson Sep 08 '17 at 07:12
1

GetOverhangMetrics is called for an inline object when the same method is called explicitly on the text layout object containing this inline object.