octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GSoC - Update [Monday 29. 07] - Latex markup


From: Michael Goffioul
Subject: Re: GSoC - Update [Monday 29. 07] - Latex markup
Date: Mon, 29 Jul 2013 16:43:11 -0400

On Mon, Jul 29, 2013 at 1:49 PM, Michael Goffioul <address@hidden> wrote:
On Mon, Jul 29, 2013 at 10:32 AM, Andrej Lojdl <address@hidden> wrote:
2013/7/29 Patrick Noffke <address@hidden>
Andrej,


Try this to make a patch:
hg diff > latex.diff

If you have committed to your repo, then you will have to specify the
revisions you are diffing.  See:

hg help diff

if you don't know how to do this.

Here is new changeset made as you explained. I already made a commit so export don't work. 
There is small change, I reverted height and width when constructing uint8NDArray and when I was writing to it. 

Here's a fix to apply on top of your changeset. This allows to have initial latex rendering. I could explain why those changes are needed, but Andrej, I'd prefer if you figured it out by yourself.

For the record, here are the changes I made:
- initialize font and color properly on the "r" object in text::properties::update_text_extent: this solves the rendering problem of ft_render
- use the actual image pixel size for bbox width and height
- swap the 2 for-loops when reading the PPM file: because you're reading the image line by line, the second dimension (j) needs to be the fastest changing
- force alpha value to be 255 (the maximum value); using 0 means the pixel is fully transparent; hence it's not displayed
- use "int" temporary variables to read the PPM file

This last point is because the following does not behave as you expect:

uint8_t r, g, b;
file >> r >> g >> b;

This will *not* read 3 integer values of 1 byte each. Internally, uint8_t is handled like "unsigned char", so you're actually reading 3 characters and convert them to integer value. For instance if your file contains the following string "255 255 255", the above snippet won't read 3 times 255 and assign them to r, g and b. Instead you'll end up with r=50, g=53 and b=53 ('2' => 50 and '5' => 53). And instead of reading 11 bytes from your file, you end up only reading 3.

Michael.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]