poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Praveen Mathew" <prmat...@in.ibm.com>
Subject Re: HWPF again
Date Tue, 24 Jun 2003 12:07:53 GMT
Ryan,

             According to spec an STTBF  has 3 shorts followed by the String and extra Data
following it. It also 
says that all the pascal strings are concatenated one after another until the length of the
STTBF 
recorded in the FIB is exhausted ( lcbSttbfffn).

What I understand is STTBF is one single BLOCK in table Stream, with the 
small header (3 shorts), & then Strings (font names) concatenated to each 
other.

I suppose this should be implemented using an array of Strings which has 
1. initial byte storing the no: of characters in the string excluding 
itself
2. last 2 bytes(short)  having extra data for that string.

My doubt: 
in the header I asumed a short  indicating the size in bytes of the extra 
data stored ( not able to find which string's data its refering?) , is it 
correct? or is it the short after each String storing the extra data ? 

In case of Fontable i,e sttbfffn, we should replace the Strings with FFN 
structure acc to spec.
but the spec of FFN structure says that it has some more header fields. 
My Doubt:
         is the XCHAR[] storing 2 strings i,e Main font & alternate font 
concatenated to each other? also 65 is the limit for these 2 combined??
        is  cbFfnM1 the total no of bytes including the XCHAR[] minus 1 ??
        is ixchSzAlt  (the index) always 1 since XCHAR[0] is main font 
XCHAR[1] is alternate font?

Lastly  for STTBFFFN we may have to use an array of FFN rit??

Also how will we track the end of STTBFFFN ??
is it using lcbSttbfffn ???

sorry for the long mail......



Thanks & Regards
Praveen

Praveen Mathew
IBM Software Labs,Airport Road,
Bangalore - 560 017,India.
Ph : +91- 80 - 504 4609 (Direct)
       +91 - 80 - 5262355 Extn: 3609
Email: prmathew@in.ibm.com




"Ryan Ackley" <sackley@cfl.rr.com>
24/06/2003 16:20
Please respond to "POI Developers List"

 
        To:     "POI Developers List" <poi-dev@jakarta.apache.org>
        cc: 
        Subject:        Re: HWPF again

 

Praveen,

You are on the right track. PANOSE and FONTSIGNATURE should be byte arrays
because they aren't in the spec but we want to preserve that information.
XCHAR are unicode strings so we can simply use a String object for xszFfn 
in
the Ffn class.

Ryan

----- Original Message ----- 
From: "Praveen Mathew" <prmathew@in.ibm.com>
To: "POI Developers List" <poi-dev@jakarta.apache.org>
Sent: Tuesday, June 24, 2003 3:15 AM
Subject: Re: HWPF again


> Ryan,
>              Plzz tell me if I am in the right track....
> I have made these classe from what I understood.....still not clear
> though.
>
> Ffn.java
>
> package org.apache.poi.hwpf.model.hdftypes;
>
> import org.apache.poi.util.BitField;
> import org.apache.poi.util.LittleEndian;
>
>
> public class Ffn
> {
>         private byte field1_cbFfnM1;            //total length of FFN - 
1.
>         private byte field2;
>
>                 private  static BitField _prq = new BitField(0x0003); //
> pitch request
>                 private  static BitField _fTrueType = new
> BitField(0x0004);       // when 1, font is a TrueType font
>                 private  static BitField _ff = new BitField(0x0070);
>
>         private short field3_wWeight;           // base weight of font
>         private byte field4_chs;                        // character set
> identifier
>         private byte field5_ixchSzAlt;          // index into ffn.szFfn 
to
> the name of the alternate font
>
>         //private PANOSE panose;                        ????
>         //private FONTSIGNATURE fs                      ????
>
>         // zero terminated string that records name of font, cuurently 
not
> supporting Extended chars
>
>         private char [] xszFfn = new char[65];
>
>         public Ffn(byte[] buf, int offset)
>         {
>
>         }
>
>         protected byte[] toByteArray()
>         {
>                 //
>
>                 return buf;
>         }
>
>
> }
>
>
> FonTable.java
>
> package org.apache.poi.hwpf.model.hdftypes;
>
> import org.apache.poi.util.BitField;
> import org.apache.poi.util.LittleEndian;
>
>
> public class FontTable
> {
>         private short exntdChar;                // strings are extended
> character if = 0xFFFF
>         private short stringCount;      // how many strings are included
> in the string table
>         private short extraDataSz;      // size in bytes of the extra 
data
>
>         private int lcbSttbfffn;
>         private boolean isExtndChar;
>
>
>         // FFN structure containing strings of font names
>
>         private Ffn     [] fontNames;
>
>         public FontTable(byte[] buf, int offset, int lcbSttbfffn)
>         {
>                 this.lcbSttbfffn = lcbSttbfffn;
>
>                 exntdChar = LittleEndian.getShort(buf, offset);
>                 offset += LittleEndian.SHORT_SIZE;
>                 stringCount = LittleEndian.getShort(buf, offset);
>                 offset += LittleEndian.SHORT_SIZE;
>                 extraDataSz = LittleEndian.getShort(buf, offset);
>                 offset += LittleEndian.SHORT_SIZE;
>
>                 if ((exntdChar & 0xFFFF) == 0xFFFF)
>                 {
>                         isExtndChar = true;
>                 }
>                 else
>                 {
>                         isExtndChar = false;
>         }
>
>         }
>
> }
>
>
> Thanks & Regards
> Praveen
>
> Praveen Mathew
> IBM Software Labs,Airport Road,
> Bangalore - 560 017,India.
> Ph : +91- 80 - 504 4609 (Direct)
>        +91 - 80 - 5262355 Extn: 3609
> Email: prmathew@in.ibm.com
>
>
>
>
> "Ryan Ackley" <sackley@cfl.rr.com>
> 23/06/2003 18:04
> Please respond to "POI Developers List"
>
>
>         To:     "POI Developers List" <poi-dev@jakarta.apache.org>
>         cc:
>         Subject:        Re: HWPF again
>
>
>
> Praveen,
>
> I have made a lot of progress since my last commit. I will try to commit
> everything tonight. I believe I can almost read in a Word file and write
> it
> back out. I haven't actually tried to do it, but I have all the code
> written. I am sure it will take some tweaking to work. I am currently
> writing test cases to see which parts aren't working. I have something 
you
> could do if you would like to help me. I need a FontTable class. Search
> for
> "sttbfffn" in the spec. that is what I need.
>
> Ryan
>
> ----- Original Message ----- 
> From: "Praveen Mathew" <prmathew@in.ibm.com>
> To: "POI Developers List" <poi-dev@jakarta.apache.org>
> Sent: Monday, June 23, 2003 8:14 AM
> Subject: Re: HWPF again
>
>
> > Hi,
> >        I tried creating a Doc from a String, and read the 
"WordDocument"
> stream from that Doc file , but there was no FIB in it...
> >
> > So no other go except to create all these Datastructures
> >
> > Thanks & Regards
> > Praveen
> >
> >
> >
> >
> >
> >
> > Praveen Mathew/India/IBM@IBMIN
> > 23/06/2003 15:23
> > Please respond to "POI Developers List"
> >
> >
> >         To:     "POI Developers List" <poi-dev@jakarta.apache.org>
> >         cc:
> >         Subject:        HWPF again
> >
> >
> >
> > Hi all,
> >              I am back to HWPF after a good vacation... I have gone
> > through the codes which Ryan has added. Thanks Ryan for your work.
> >
> > I am planning to create a Doc file with just 1 character in it...say
> "H".
> > This means I only have to deal with the minimum datastructures and 
that
> > too for the
> > condition where index = 0.
> >
> > I need some help regarding this.
> >
> > I am going to convert a String with "H" into a ByteArrayInputStream&
> then
> > using POIFS createDocument make a Doc, which will only have the
> > "WordDocument"
> > stream.  I suppose this will create a FIB which I can modify.
> >
> > But there is no way I can create a "1Table" stream as I did above, I
> > should create it myself.
> >
> > So I need to know what is the order in which i should go on creating 
the
> > different DataStructures, like PlexofCps, DiskFormatedPage, CHPX, PAPX
> > etc... for making the "1Table" stream. Since I have only one character
> "H"
> >
> >
> > I will have only 1 instance of all the dataStructures.
> > How will I link the FIB in "WordDocument" stream with "1Table" 
stream?.
> > Also If I need to show the "H" font = Arial, which datastructure 
should
> I
> > edit?
> >
> >
> > Thanks & Regards
> > Praveen
> >
> >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-dev-help@jakarta.apache.org
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-dev-help@jakarta.apache.org




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message