Quantcast
Channel: R.NET
Viewing all articles
Browse latest Browse all 1634

Commented Unassigned: RdotNet.Graphics, text function misbehavior [148]

$
0
0
Hi all,

I have come up with an issue related to displaying text through the R text() function. Specifically, the DrawText@GraphicsDeviceAdapter gets called with the wrong y value. This behavior can be only observed when the text() function is directly invoked to diplay text in the device, and assuming the R plot() function relies on it for displaying characters, it gets correctly called to plot the axis ticks values as shown in the RdotNet.Graphics.Test app.

Any ideas on this,
Jesus
Comments: Ahh, ok. In DeviceDescription.cs:266 CharacterSizeInRasterY = 12.0; is incorrect. You'll need to initialize these default parameters with the font that is being rendered. In my internal version of R.Net, we do something like this: public static readonly Font DefaultFont = new Font("Arial", 12, GraphicsUnit.Point); .... public void SetDeviceParameters(DeviceDescription description) { description.CharacterSizeInRasterY = DefaultFont.GetHeight(); .... There is a "bug" in the test fixture, but there is not a bug in R.Net. That negative value comes from what is essentially bad data. The R base graphics system is just responding to that bad data and trying to do the right thing which is why you get that odd negative value. If you are going to be working with graphics devices, reading the "R Internals" document, Chapter 6 over and over is worth doing. I'll get a PR submitted for the test case later this evening.

Viewing all articles
Browse latest Browse all 1634

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>