UT_PAPER_UNITS_PER_INCH too small


Subject: UT_PAPER_UNITS_PER_INCH too small
From: Henrik Berg (henrik@lansen.se)
Date: Wed Dec 01 1999 - 07:16:46 CST


I was thinking to add some more international (non us) possibilities, and found this:

#define UT_PAPER_UNITS_PER_INCH 100

Is this value good? In function UT_paperUnits file ut_units.cpp the code looks like this:

 double dInches = UT_convertToInches(sz);
 double dResolution = UT_PAPER_UNITS_PER_INCH;
 return (UT_sint32)(dInches * dResolution);

This means that I cant speak about 2pt because it becomes 0,02778 inch and multiplied with UT_PAPER_UNITS_PER_INCH gives 2,778 then retured as signed int32 as 2. Translated back gives 1pt.

This is a problem still found in many program. I think its better to change this now, before it get too complicated. Two possible changes.

1. Change UT_PAPER_UNITS_PER_INCH to something real great like 65536. then we can still talk about 32767 inch. And hope fully translations between units can be done correctly.

2. Change the inner unit to something small like "mm" or "pt" and talk about 100th or 1000th of those.

I would go for 1 :)

--hb




This archive was generated by hypermail 2b25 : Wed Dec 01 1999 - 08:02:36 CST