Questions tagged [directwrite]

DirectWrite is a text layout and glyph rendering API by Microsoft. It was designed to replace GDI/GDI+ and Uniscribe for screen-oriented rendering and was shipped with Windows 7 and Windows Server 2008 R2, as well as Windows Vista and Windows Server 2008 (with Platform Update installed). DirectWrite provides these features

DirectWrite is a text layout and glyph rendering API by Microsoft. It was designed to replace GDI/GDI+ and Uniscribe for screen-oriented rendering and was shipped with Windows 7 and Windows Server 2008 R2, as well as Windows Vista and Windows Server 2008 (with Platform Update installed). DirectWrite provides these features

  • A device-independent text layout system that improves text readability in documents and in UI.
  • High-quality, sub-pixel, ClearType text rendering that can use GDI, Direct2D, or application-specific rendering technology.
  • Hardware-accelerated text, when used with Direct2D.
  • Support for multi-format text.
  • Support for the advanced typography features of OpenType fonts.
  • Support for the layout and rendering of text in all supported languages.
  • GDI-compatible layout and rendering.
149 questions
0
votes
1 answer

DirectWrite lists regular, Oblique, Bold, Bold Oblique versions of Microsoft Sans Serif, but they all point to the same TTF file

So I have used the DirectWrite APIs to query the available fonts in my system. One of the fonts is Microsoft Sans Serif. DirectWrite returns me four faces for this font: Regular, Oblique, Bold and Bold Oblique, but when I obtain the Font File Path…
0
votes
1 answer

Trying to use custom fonts with DirectWrite

I am trying to load a font file from memory. The resource script defines the font like this: ID_FONT CUSTOM_RC "res/Montserrat-Regular.ttf" And then I try to load the font resource like this: IDWriteFactory5* dwFactory =…
0
votes
1 answer

`CreateCustomFontFileReference` keeps failing with 0x80070057 "The parameter is incorrect"

I'm trying to load fonts from memory in Direct2D, but keep getting error 0x80070057 ("The parameter is incorrect") from CreateCustomFontFileReference(). I'm following the instructions here to support Windows 7/8: Custom Font Collections (Windows…
dev65
  • 1,440
  • 10
  • 25
0
votes
0 answers

Does `textPosition` parameter in `IDWriteTextLayout::HitTestTextPosition` means the utf-16 index or the `wchar_t` index

The method IDWriteTextLayout::HitTestTextPosition takes the first parameter as UINT32 textPosition which the docs describe as: The text position used to get the pixel location. But I can't fully understand the meaning of text position in this…
dev65
  • 1,440
  • 10
  • 25
0
votes
1 answer

Handle device loss with IDWriteTextLayout::SetDrawingEffect

Following up on How can I render mixed-colour text in DirectWrite?, what's the best practice to handle device loss when passing a device-dependent resource — e.g. an ID2D1LinearGradientBrush or any other ID2D1Brush — as the first parameter of…
user16501294
0
votes
1 answer

Can you create a mathbuildup using IDWRITE?

Is there already a built-in mechanism or method for creating a mathbuild using only the IDWRITE interfaces that would produce a similar type of math buildup compared to using an RTF window with the OLE/ITextRange2/ITextFont2 interfaces?
0
votes
1 answer

DirectWrite infinitely long strings performance

In the DirectWrite guides and examples I only found solutions for creating layout and rendering relatively small strings, i.e. with not a big number of characters. Currently I understand that the method with the best performance is to create and…
Ngdgvcb
  • 155
  • 6
0
votes
1 answer

#include in C++ works, but not in C

A single-line test.c: #include From the visual studio command prompt, compiled as C++ works: cl /c /Tp test.c compiled as C does not: cl /c test.c First, I get a bunch of errors as this one: C:\Program Files (x86)\Windows…
aleksazr
  • 89
  • 7
0
votes
0 answers

Finding the bottom side bearing in GDI

With GDI you can retrieve the LSB (left side bearing) and width of text by using GetCharABCWidthsW. However, there is no equivalent for the bottom side bearing that I can find. With DirectWrite it's included with DWRITE_GLYPH_METRICS but I cannot…
Charlie
  • 680
  • 4
  • 11
0
votes
0 answers

Direct2D/DirectWrite Does IDWriteFactory::CreateTextLayout need to release every time when update the text in CreateTextLayout?

I am doing Direct2D show some text (like fps, resolution etc) on Direct3D surface. The weird thing is that in my Window Class there is a method called CalculateFrameStats() where every loop, use this to calcualte the FPS etc information and use…
Bill Banks
  • 55
  • 1
  • 8
0
votes
1 answer

How to access IDWriteLocalFontFileLoader method in c#

im using DirectN in my project, everything else works fine, i can use DWriteFunctions class to create a factory, except i can't find a class to access IDWriteLocalFontFileLoader interface to use the method inside. i googled a lot but i just don't…
0
votes
1 answer

Direct2D widthIncludingTrailingWhitespace == 0 while width > 0?

An issue with Microsoft's Direct2D framework. How is it possible that width > widthIncludingTrailingWhitespace? Shouldn't it be width == widthIncludingTrailingWhitespace in the case of no trailing spaces and width <…
Viktor Be
  • 658
  • 1
  • 11
  • 25
0
votes
1 answer

how to enable/disable System fonts in Windows 10 using DWrite APIs

Hi I need to enable/disable system fonts in Windows 10 using DWrite APIs. Is there any flag by using that I can enable/disable fonts.
0
votes
0 answers

DirectWrite painting ligatures with multiple colors?

I'm using Microsoft's Cascadia Code font and drawing text with DirectWrite using ID2D1RenderTarget::DrawTextLayout, with individual glyphs colored using IDWriteTextLayout::SetDrawingEffect(CreateSolidColorBrush(...)). Cascadia Code has a ligature…
Zoë Peterson
  • 13,094
  • 2
  • 44
  • 64
0
votes
0 answers

Is there a way to render an IDWriteTextLayout starting from a different position than x=0 / y=0?

When you have a TextLayout which is just partially visible and don't want to render everything, are there any methods to change the startingpoint for rendering? CComPtr
P Weiss
  • 1
  • 1
  • 1