Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support DirectWrite #29

Open
khongten001 opened this issue Nov 21, 2017 · 4 comments
Open

Support DirectWrite #29

khongten001 opened this issue Nov 21, 2017 · 4 comments

Comments

@khongten001
Copy link

As title, is there any chance to get this?

Thanks

@CWBudde
Copy link
Contributor

CWBudde commented Nov 21, 2017

Please specify how you think a support could look like. Would it be satisfying to add a thin layer/wrapper to allow text layout / glyph rendering by DirectWrite?
If so, it would still use the CPU for text rendering. This might not be faster, but obviously more advanced in terms of possiblities (think of rtl support for example).

The full potential of DirectWrite can only get exposed if used with Direct2D, which itself is very similar to Graphics32. There would be a big overlap of functionality and thus there might be only little advantages of using GR32 code anymore.

At the same time one would inherit all the problems of Direct2D. That is the platform dependency, which at least require Windows 7. And beyond the basic support, Windows 10 is recommended for the full potential.

All together it would make sense to use DirectWrite with Direct2D for a software that is meant to run on the Windows platform solely. If you only need a few features of DirectWrite than a thin layer would make sense, which we should put on the todo list.

If you want to speed things up, you can specify your request and/or write some code that demonstrates what you have in mind. If it is good enough already we can easily merge it to GR32 then.

@khongten001
Copy link
Author

khongten001 commented Nov 22, 2017

I tried to implement some thing like this:

TDirectWriteTextRender = class
public
	constructor Create(ABitmap32: TBitmap32);
	procedure Render(AText: string; AX, AY: Integer; AColor: TColor32);
end;

But I couldn't get it works. This method won't break the current code. The RenderText method of GR32 is slower than DirectWrite. It's very nice if GR32 supports DirectWrite. Thank you very much.

@CWBudde
Copy link
Contributor

CWBudde commented Jan 6, 2019

I have started to look into it from a different perspective. So far the TextToPath uses GDI, which doesn't support all the different scripts and font systems out there. Thus I wanted to replace it with DirectWrite. Beside a more versatile use, the speed could also get better by this step as the translation between the GDI outline output and GR32 isn't optimal so far.

Unfortunately, the D2D1 unit supplied by Embarcadero has a few mistakes (or translation errors from C++ to Delphi), which makes it a bit complicated. In addition, the current GR32 interface is currently very close to GDI, given the fact that the VCL is very close to GDI itself. There are a few interop functions to use GDI managed fonts in DirectWrite, but I guess under the hood, this will be the same as to use GDI directly.

@CWBudde CWBudde added this to To do in 3.x (New features) Apr 15, 2019
@chmichael
Copy link

How about adding a Direct2D backend with DirectWrite support ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

3 participants