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

RE: [XaraXtreme-dev] Current/default font



As Gerry pointed out, a newly applied "Times New Roman" fontface
attribute does not optimise out because it has a valid font handle but
the default font face attribute doesn't have a valid font handle.

The default attribute is created in txtattr.cpp,
TxtFontTypefaceAttribute::Init(), with a default value of 0, whereas
attributes applied from the font dropdown are assigned handle values
using this command,
	TypeFaceAttrib->Value.HTypeface =
FONTMANAGER->GetFontHandle(&InfoData.FontName, InfoData.FontType);
in TextInfoBarOp::OnFieldChange. The first handle handed out is 1, for
Arial.

There are no comments saying that the default 0 handle is used
deliberately in the knowledge that GetFontHandle will never return 0 so
it looks like a bug to me BUT it could be a very useful one...

Phil 

> -----Original Message-----
> From: owner-dev@xxxxxxxxxxxxxxxx 
> [mailto:owner-dev@xxxxxxxxxxxxxxxx] On Behalf Of Phil Martin
> Sent: 27 July 2006 14:29
> To: dev@xxxxxxxxxxxxxx
> Subject: RE: [XaraXtreme-dev] Current/default font
> 
> Hi Martin,
> 
> Technically, it's correct to keep records as small as 
> possible but that becomes less important for records that are 
> rarely used and in the end if the information carried by a 
> record is required then it's got to be present no matter how 
> big the record is. (Personally I'm not sure record size is so 
> much of an issue these days but we'd have to formally agree a 
> new position on that.)
> 
> I know it's frustrating trying to navigate through all the 
> old code and all the old decisions and assumptions behind 
> them, many of them hidden to us now.
> 
> I notice that Xtreme's in-memory tree has a font face 
> attribute stored locally when "Times New Roman" is applied to 
> a Story. That explains why the XAR file has the equivalent 
> records. I'll try to find out why that attribute is not being 
> optimised out and let you know whether it's deliberate or 
> accidental...
> 
> Phil 
> 
> > -----Original Message-----
> > From: owner-dev@xxxxxxxxxxxxxxxx
> > [mailto:owner-dev@xxxxxxxxxxxxxxxx] On Behalf Of Martin Wuerthner
> > Sent: 27 July 2006 14:06
> > To: dev@xxxxxxxxxxxxxx
> > Subject: RE: [XaraXtreme-dev] Current/default font
> > 
> > Hi Phil,
> > 
> > In message
> > <5056CBC646CB4047BB26120F4377DB71DC8425@xxxxxxxxxxxxxxxxxxx
> > >
> >           "Phil Martin" <Phil@xxxxxxxx> wrote:
> > 
> > > Yes I did mean "Times New Roman" and the presence of those
> > records in
> > > the XAR document does not necessarily indicate a bug: The
> > text system
> > > could be writing out font face records deliberately even 
> when font 
> > > face attributes are not present in the in-memory tree.
> > 
> > In theory, it could, but I do not think it does (do a grep for 
> > TAG_FONT_TYPEFACE and you see that only the attribute node 
> saving code 
> > itself writes this record), and if it did, it would still be wrong.
> > When I designed the file records for the new attributes I 
> was gently 
> > told off for using a few unnecessary *bytes* in my first design and 
> > was asked to make sure the file is as small as possible. 
> Surely, there 
> > would be absolutely no point in the text system writing superfluous
> > *records* to the file, would there?
> > 
> > Martin
> > 
>