jingwood / d2dlib

A .NET library for hardware-accelerated, high performance, immediate mode rendering via Direct2D.
MIT License
234 stars 40 forks source link

Drawing a font in italic style #70

Closed aizu03 closed 1 year ago

aizu03 commented 2 years ago

Hi,

I love this library! I was trying to draw some text and everything worked but how do I draw text in italic?

This is the code I'm currently using:

var font = new Font("Consolas", 12f, FontStyle.Italic); d2d.DrawText("Some text in italic", D2DColor.White, font.Name, font.Size, 4, 4);

Is there a way to use the font object with all it's properties instead of the name and size? This would reduce overhead as well.

It would be nice to have this. I'm using the library to draw a little code interface. And multi line comments in italic would be a nice touch!

https://i.imgur.com/zAkFCQN.png

jingwood commented 2 years ago

Thanks! I will add the support for style option as well as a font object as argument.

jingwood commented 1 year ago

It has been implemented in #94 from v1.4.1.