JP2005208810A - Document analysis device and method, program for document analysis device, and printer - Google Patents

Document analysis device and method, program for document analysis device, and printer Download PDF

Info

Publication number
JP2005208810A
JP2005208810A JP2004013072A JP2004013072A JP2005208810A JP 2005208810 A JP2005208810 A JP 2005208810A JP 2004013072 A JP2004013072 A JP 2004013072A JP 2004013072 A JP2004013072 A JP 2004013072A JP 2005208810 A JP2005208810 A JP 2005208810A
Authority
JP
Japan
Prior art keywords
layout
laid out
area
document
floating
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2004013072A
Other languages
Japanese (ja)
Inventor
Hirotaka Akamatsu
裕隆 赤松
Shigeki Kazuma
茂樹 数馬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Seiko Epson Corp
Original Assignee
Seiko Epson Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Seiko Epson Corp filed Critical Seiko Epson Corp
Priority to JP2004013072A priority Critical patent/JP2005208810A/en
Publication of JP2005208810A publication Critical patent/JP2005208810A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Document Processing Apparatus (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To properly lay out a floating body and a table without lack of contents thereof. <P>SOLUTION: Every time floating bodies are registered, the area except the floating bodies within an layout-possible area is set as a layout-possible area on a page box. When a table is laid out, the set layout-possible area is acquired in order from the top ((a) in the drawing), and it is determined whether the width of the table is fitted within the width of the layout-possible area. When the width of the table is fitted, the table is laid out within the layout-possible area acquired at that time. When the width of the table is not fitted, the next layout-possible area is acquired from another line ((b) in the drawing), and the processing is repeated twice in total. When the width of the table is not fitted to the width of the layout-possible area regardless of such a repeated processing, clear characteristic is applied to acquire a layout-possible area in a line including no floating body, and the table is laid out in this layout-possible area ((c) in the drawing). <P>COPYRIGHT: (C)2005,JPO&NCIPI

Description

本発明は、文書解析装置およびその方法並びに文書解析装置用のプログラム、印刷装置に関し、詳しくは、所定の言語で記述された構造化文書を解析して出力する文書解析装置およびその方法並びに文書解析装置用のプログラム、印刷装置に関する。   The present invention relates to a document analysis apparatus and method, a program for the document analysis apparatus, and a printing apparatus. More specifically, the present invention relates to a document analysis apparatus and method for analyzing and outputting a structured document described in a predetermined language, and document analysis. The present invention relates to a device program and a printing device.

従来、この種の文書解析装置としては、HTML(Hyper Text Markup Language)などのマークアップ言語により記述された構造化文書で指定された要素を解析しレイアウトして出力するものが提案されている(例えば、特許文献1参照)。   Conventionally, as this type of document analysis apparatus, an apparatus that analyzes, lays out, and outputs an element specified in a structured document described in a markup language such as HTML (Hyper Text Markup Language) has been proposed ( For example, see Patent Document 1).

こうした構造化文書中に指定された要素をレイアウトする際、通常、段落などの前後に改行を伴うブロック毎にそのブロック内にテキストや画像などのボックスを行単位で作成してレイアウトしていく。このとき、構造化文書中に表要素が含まれているときには、この表要素を段落などと同様にブロックとして扱って表の構成単位であるセルを格子状にレイアウトする。また、構造化文書中に浮動要素が含まれているときには、右詰か左詰かの指定に従って現在の行の左または右にボックスを詰めてレイアウトする。レイアウトされた浮動要素は、ブロックのレイアウトに影響を与えることがなく、例えば、複数の段落に跨って存在することもできる。
特開2000−242641号公報
When laying out an element designated in such a structured document, a box such as a text or an image is usually created and laid out in a block for each block with a line break before and after a paragraph or the like. At this time, when the structured document includes a table element, the table element is treated as a block in the same manner as a paragraph or the like, and the cells constituting the table are laid out in a grid pattern. If the structured document contains floating elements, the layout is done by filling the box to the left or right of the current line according to the specification of right or left justification. The laid out floating element does not affect the layout of the block, and can exist, for example, across a plurality of paragraphs.
JP 2000-242641 A

上述の文書解析装置では、構造化文書中に表要素と浮動要素と含まれると、浮動要素と表要素とが重ねてレイアウトされてしまい、表の内容(データ)が欠落してしまう場合がある。これは、前述したように表要素は段落などと同様にブロックとして扱われ、浮動要素はブロックのレイアウトに影響を与えないから、浮動要素と表要素とがレイアウトされる位置によっては表要素と浮動要素とが重なってしまうことに基づく。   In the above document analysis apparatus, if a structured element includes a table element and a floating element, the floating element and the table element are laid out in an overlapping manner, and the contents (data) of the table may be lost. . This is because, as described above, table elements are treated as blocks like paragraphs, etc., and floating elements do not affect the layout of the block. Based on overlapping elements.

本発明の文書解析装置およびその方法並びに印刷解析装置用のプログラムは、こうした問題を解決し、構造化文書に含まれる表要素と浮動要素とをその内容を欠落させることなくより適切にレイアウトして出力することを目的の一つとする。また、本発明の印刷装置は、構造化文書に含まれる表要素と浮動要素とをその内容を欠落させることなくより適切にレイアウトして印刷することを目的の一つとする。   The document analysis apparatus and method of the present invention and the program for the print analysis apparatus solve these problems, and more appropriately lay out the table elements and floating elements included in the structured document without losing the contents. One of the purposes is to output. Another object of the printing apparatus of the present invention is to appropriately lay out and print table elements and floating elements included in a structured document without losing the contents.

本発明の文書解析装置およびその方法並びに文書解析装置用のプログラム、印刷装置は、上述の目的の少なくとも一部を達成するために以下の手段を採った。   The document analysis apparatus and method of the present invention, the program for the document analysis apparatus, and the printing apparatus employ the following means in order to achieve at least a part of the above object.

本発明の文書解析装置は、
所定の言語で記述された構造化文書を解析して出力する文書解析装置であって、
前記構造化文書が指定されたとき、該指定された構造化文書を受け付けて解析する解析手段と、
該解析した構造化文書中に含まれる要素を順次レイアウトし、該構造化文書中に浮動要素が含まれると共に該浮動要素がレイアウトされる行と同一の行の領域にレイアウトされる表要素が含まれるときには、該表要素が該浮動要素に重ならないよう該表要素をレイアウトするレイアウト手段と、
該レイアウトされた要素を描画して出力する出力手段と
を備えることを要旨とする。
The document analysis apparatus of the present invention
A document analysis device that analyzes and outputs a structured document described in a predetermined language,
When the structured document is designated, an analysis means for accepting and analyzing the designated structured document;
The elements included in the analyzed structured document are sequentially laid out, and the structured document includes a floating element and a table element that is laid out in the same line area as the line on which the floating element is laid out. Layout means for laying out the table element such that the table element does not overlap the floating element;
And an output means for drawing and outputting the laid out elements.

この本発明の文書解析装置では、構造化文書が指定されたとき、この指定された構造化文書を受け付けて解析し、解析した構造化文書中に含まれる要素を順次レイアウトし、構造化文書中に浮動要素が含まれると共にこの浮動要素がレイアウトされる行と同一の行の領域にレイアウトされる表要素が含まれるときには、この表要素が浮動要素に重ならないよう表要素をレイアウトする。したがって、表要素と浮動要素が同一の行の領域にあるときにその内容を欠落させることなくより適切にレイアウトして出力することができる。   In the document analysis apparatus of the present invention, when a structured document is designated, the designated structured document is received and analyzed, elements included in the analyzed structured document are sequentially laid out, and the structured document contains When the table element is laid out in the same row area as the row in which the floating element is laid out, the table element is laid out so that the table element does not overlap the floating element. Therefore, when the table element and the floating element are in the same row area, the contents can be laid out and output more appropriately without losing the contents.

こうした本発明の文書解析装置において、前記レイアウト手段は、前記浮動要素がレイアウトされる行の領域のうち該浮動要素の領域を除いたレイアウト可能領域を設定し、該設定したレイアウト可能領域に前記表要素をレイアウトする手段であるものとすることもできる。こうすれば、表要素と浮動要素とが重なることなく同一の行の領域にレイアウトすることができる。この態様の本発明の文書解析装置において、前記レイアウト手段は、前記設定したレイアウト可能領域に前記表要素をレイアウトできないときには、前記浮動要素を包含しない行まで行替えしてレイアウト可能領域を設定し、該設定したレイアウト可能領域に該表要素をレイアウトする手段であるものとすることもできる。こうすれば、表要素と浮動要素とが同一の行の領域に収まらないときでもその内容を欠落させることなくレイアウトすることができる。さらに、この態様の本発明の文書解析装置において、前記レイアウト手段は、同一の行の領域に複数の浮動要素がレイアウトされたときに該複数の浮動要素により複数のレイアウト可能領域が設定されたとき、前記表要素がレイアウト可能となるまで所定回数に亘って順にレイアウト可能領域を替えて該表要素をレイアウトする処理を繰り返し、該所定回数に亘ってレイアウト可能領域を替えたにも拘わらず該表要素が該複数のレイアウト可能領域のいずれにもレイアウトできないときには、該複数の浮動要素のすべてを包含しない行のレイアウト可能領域を設定し、該設定したレイアウト可能領域に該表要素をレイアウトする手段であるものとすることもできる。こうすれば、複数の浮動要素がレイアウトされている場合でも対処することができる。この態様の本発明の文書解析装置において、前記所定回数は、1回または2回であるものとすることもできる。こうすれば、装置の負荷を抑制できる。   In such a document analysis apparatus of the present invention, the layout means sets a layable area excluding the floating element area in a row area where the floating element is laid out, and the table is displayed in the set layable area. It can also be a means for laying out elements. By doing this, it is possible to lay out in the region of the same row without overlapping the table element and the floating element. In the document analysis apparatus according to the aspect of the present invention, when the layout unit cannot lay out the table element in the set layout available area, the layout unit sets a layout available area by changing to a line that does not include the floating element, The table element may be laid out in the set layout possible area. In this way, even when the table element and the floating element do not fit in the same row area, the layout can be performed without losing the contents. Furthermore, in the document analysis apparatus of the present invention according to this aspect, when the plurality of floating elements are set by the plurality of floating elements when the plurality of floating elements are laid out in the same row area, The table element is repeatedly laid out by changing the layoutable area in order until the table element can be laid out, and the table element is laid out in spite of the predetermined number of times. When an element cannot be laid out in any of the plurality of layoutable areas, means for setting a layoutable area in a row that does not include all of the plurality of floating elements and laying out the table element in the set layoutable area It can also be. In this way, it is possible to handle even when a plurality of floating elements are laid out. In this aspect of the document analysis apparatus of the present invention, the predetermined number of times may be once or twice. In this way, the load on the apparatus can be suppressed.

また、本発明の文書解析装置において、前記構造化文書は、前記所定の言語としてマークアップ言語により記述された文書であるものとすることもできる。この態様の本発明の文書解析装置において、前記マークアップ言語は、XHTMLであるものとすることもできる。   In the document analysis apparatus of the present invention, the structured document may be a document described in a markup language as the predetermined language. In this aspect of the document analysis apparatus of the present invention, the markup language may be XHTML.

本発明の印刷装置は、
上述した各態様のいずれかの本発明の文書解析装置
を備えることを要旨とする。
The printing apparatus of the present invention includes:
The gist of the invention is that it includes the document analysis apparatus according to any one of the above-described aspects.

この本発明の印刷装置では、本発明の文書解析装置、即ち、基本的には、所定の言語で記述された構造化文書を解析して出力する文書解析装置であって、前記構造化文書が指定されたとき、該指定された構造化文書を受け付けて解析する解析手段と、該解析した構造化文書中に含まれる要素を順次レイアウトし、該構造化文書中に浮動要素が含まれると共に該浮動要素がレイアウトされる行と同一の行の領域にレイアウトされる表要素が含まれるときには、該表要素が該浮動要素に重ならないよう該表要素をレイアウトするレイアウト手段と、該レイアウトされた要素を描画して出力する出力手段とを備える文書解析装置を備えるから、本発明の文書解析装置と同様の効果、例えば、表要素と浮動要素が同一の行の領域にあるときにその内容を欠落させることなくより適切にレイアウトして印刷することができる効果などを奏することができる。   The printing apparatus according to the present invention is a document analysis apparatus according to the present invention, that is, a document analysis apparatus that basically analyzes and outputs a structured document described in a predetermined language. When specified, an analysis unit that receives and analyzes the specified structured document, and sequentially lays out elements included in the analyzed structured document, and includes floating elements in the structured document and Layout means for laying out the table element so that the table element does not overlap the floating element when the table element is laid out in the same row area as the row in which the floating element is laid out; And a document analysis apparatus including an output means for rendering and outputting the same effect as the document analysis apparatus of the present invention, for example, the contents when the table element and the floating element are in the same row area More properly without missing it can be obtained and the effect that can be printed by the layout.

本発明の文書解析方法は、
所定の言語で記述された構造化文書を解析して出力する文書解析装置であって、
(a)前記構造化文書が指定されたとき、該指定された構造化文書を受け付けて解析し、
(b)該解析した構造化文書中に含まれる要素を順次レイアウトし、該構造化文書中に浮動要素が含まれると共に該浮動要素がレイアウトされる行と同一の行の領域にレイアウトされる表要素が含まれるときには、該表要素が該浮動要素に重ならないよう該表要素をレイアウトし、
(c)該レイアウトされた要素を描画して出力する
ことを要旨とする。
The document analysis method of the present invention includes:
A document analysis device that analyzes and outputs a structured document described in a predetermined language,
(A) When the structured document is designated, the designated structured document is received and analyzed;
(B) A table in which elements included in the analyzed structured document are sequentially laid out and a floating element is included in the structured document and is laid out in an area on the same line as the line on which the floating element is laid out When an element is included, lay out the table element so that the table element does not overlap the floating element;
(C) The gist is to render and output the laid out elements.

この本発明の文書解析方法によれば、構造化文書が指定されたとき、この指定された構造化文書を受け付けて解析し、解析した構造化文書中に含まれる要素を順次レイアウトし、構造化文書中に浮動要素が含まれると共にこの浮動要素がレイアウトされる行と同一の行の領域にレイアウトされる表要素が含まれるときには、この表要素が浮動要素に重ならないよう表要素をレイアウトするから、表要素と浮動要素が同一の行の領域にあるときにその内容を欠落させることなくより適切にレイアウトして出力することができる。   According to the document analysis method of the present invention, when a structured document is designated, the designated structured document is received and analyzed, elements included in the analyzed structured document are sequentially laid out, and structured. If a document contains a floating element and a table element that is laid out in the same line area as the line where the floating element is laid out, the table element is laid out so that it does not overlap the floating element. When the table element and the floating element are in the area of the same row, the contents can be laid out more appropriately without being lost.

本発明の文書解析装置用のプログラムは、
所定の言語で記述された構造化文書を解析して出力する文書解析装置に用いられるプログラムであって、
前記構造化文書が指定されたとき、該指定された構造化文書を受け付けて解析するモジュールと、
該解析した構造化文書中に含まれる要素を順次レイアウトし、該構造化文書中に浮動要素が含まれると共に該浮動要素がレイアウトされる行と同一の行の領域にレイアウトされる表要素が含まれるときには、該表要素が該浮動要素に重ならないよう該表要素をレイアウトするモジュールと、
該レイアウトされた要素を描画して出力するモジュールと
を備えることを要旨とする。
The program for the document analysis apparatus of the present invention is:
A program used in a document analysis apparatus that analyzes and outputs a structured document described in a predetermined language,
A module that accepts and analyzes the designated structured document when the structured document is designated;
The elements included in the analyzed structured document are sequentially laid out, and the structured document includes a floating element and a table element that is laid out in the same line area as the line on which the floating element is laid out. A module that lays out the table element such that the table element does not overlap the floating element;
And a module for drawing and outputting the laid-out elements.

この本発明の文書解析装置用のプログラムでは、文書解析装置にインストールすることにより、構造化文書が指定されたとき、この指定された構造化文書を受け付けて解析し、解析した構造化文書中に含まれる要素を順次レイアウトし、構造化文書中に浮動要素が含まれると共にこの浮動要素がレイアウトされる行と同一の行の領域にレイアウトされる表要素が含まれるときには、この表要素が浮動要素に重ならないよう表要素をレイアウトする。したがって、表要素と浮動要素が同一の行の領域にあるときにその内容を欠落させることなくより適切にレイアウトして出力することができる。   In the program for the document analysis apparatus of the present invention, when a structured document is designated by installing it in the document analysis apparatus, the designated structured document is received and analyzed, and the structured document is analyzed. If the included elements are laid out sequentially and the structured document contains a floating element and a table element that is laid out in the same line area as the line where the floating element is laid out, then this table element Layout the table elements so that they do not overlap. Therefore, when the table element and the floating element are in the same row area, the contents can be laid out and output more appropriately without losing the contents.

次に、本発明を実施するための最良の形態を実施例を用いて説明する。   Next, the best mode for carrying out the present invention will be described using examples.

図1は、本発明の一実施例としてのカラーインクジェットプリンタ20の構成の概略を示す構成図である。実施例のカラーインクジェットプリンタ20は、図示するように、コンピュータ10やデジタルテレビ12,デジタルカメラ14などと接続してデジタル画像(以下、画像という)の入力を司る入力インターフェース22と、入力インタフェース22に入力される画像の形式に基づいてデータの出力先を割り振る信号処理部24と、マークアップ言語としてのXHTML(eXtensible Hyper Text Markup Language)により記述されたXHTML文書を解析して要素の木構造としてのDOM(Document Object Model)ツリーを作成すると共にCSS(Cascading Style Sheets)により記述されたCSS文書を読み込んでスタイルオブジェクトを作成してメモリ50に書き込む解析部30と、解析部30により作成されたDOMツリーとスタイルオブジェクトとを用いてXHTML文書に記述された要素(オブジェクト)としての表や画像やテキストを印刷用のページ毎にレイアウトしてページボックスとしてメモリ50に書き込むレイアウタ38と、レイアウタ38によりレイアウトして得られるページボックスを用いてRBGデータとしての印刷用画像を描画するレンダリングプラグイン(以下、RPIという)40と、描画されたRGB(Red Green Blue)データの印刷用画面をCMYK(Cyan Magenta Yellow Black)データに変換する色変換部42と、変換されたCMYKデータを誤差拡散処理などの画像処理を行なって2値化する2値化部44と、2値化されたCMYKの各データを図示しない印刷ヘッドを備える印刷実行部48にバンド単位で出力するために一時的にデータを蓄えるイメージバッファ46とを備える。   FIG. 1 is a configuration diagram showing an outline of the configuration of a color inkjet printer 20 as an embodiment of the present invention. As shown in the figure, the color inkjet printer 20 of the embodiment is connected to a computer 10, a digital television 12, a digital camera 14, and the like, and an input interface 22 that controls input of a digital image (hereinafter referred to as an image), and an input interface 22 Analyzing an XHTML document described in XHTML (eXtensible Hyper Text Markup Language) as a markup language by assigning an output destination of data based on the format of the input image, and as an element tree structure Creates a DOM (Document Object Model) tree and reads a CSS document described by CSS (Cascading Style Sheets) to create a style object and create a memory The table, image, and text as the elements (objects) described in the XHTML document are laid out for each page for printing using the analysis unit 30 written in 50, and the DOM tree and style object created by the analysis unit 30. A layouter 38 that writes to the memory 50 as a page box, a rendering plug-in (hereinafter referred to as RPI) 40 that renders an image for printing as RBG data using a page box obtained by laying out by the layouter 38, A color conversion unit 42 that converts a screen for printing RGB (Red Green Blue) data into CMYK (Cyan Magenta Yellow Black) data, and binarizing the converted CMYK data by performing image processing such as error diffusion processing 2 Pricing unit 44 and 2 An image buffer 46 is provided for temporarily storing the data in order to output the digitized CMYK data to a print execution unit 48 having a print head (not shown) in units of bands.

信号処理部24は、入力された信号が直ちに印刷可能な印刷用データの場合には印刷実行部48のイメージバッファ46にデータを出力し、RGBデータの場合にはメモリ50の印刷用画面格納領域に出力し、XHTML文書で記述されたファイルの場合には解析部30に出力する。   The signal processing unit 24 outputs the data to the image buffer 46 of the print execution unit 48 when the input signal is printable data that can be printed immediately, and the print screen storage area of the memory 50 when the input signal is RGB data. In the case of a file described in an XHTML document, it is output to the analysis unit 30.

解析部30は、XHTML文書の解析を指示することによりDOMツリーを作成するコア32と、コア32からの指示に基づいてXHTML文書を解析するXMLパーサー34と、作成されたDOMツリーの各要素の初期化処理により依頼されたCSS文書を解析するCSSプラグイン(以下、CSSPIという)36とから構成されている。   The analysis unit 30 generates a DOM tree by instructing the analysis of the XHTML document, an XML parser 34 that analyzes the XHTML document based on the instruction from the core 32, and each element of the generated DOM tree. It comprises a CSS plug-in (hereinafter referred to as CSSI) 36 for analyzing the CSS document requested by the initialization process.

次に、こうして構成された実施例のカラーインクジェットプリンタ20の動作、特にXHTML文書を印刷する際の動作について説明する。図2は、解析部30により実行される解析レイアウト指示処理の一例を示すフローチャートである。この処理は所定時間毎(例えば、8msec毎)に繰り返し実行される。解析レイアウト指示処理が実行されると、まず、XHTML文書を特定するためのURL(Uniform Resouce Locator)の指定があるか否かを判定し(ステップS100)、URLの指定があるときにはそのURLをメモリ50に領域設定されたURL格納用バッファ領域に格納し(ステップS110)、URLの指定がないときには次の処理に進む。URL指定は、例えば、操作者がデジタルテレビ12で表示された印刷可能な項目のうちカラーインクジェットプリンタ20で印刷しようとする項目を選択したときデジタルテレビ12からのカラーインクジェットプリンタ20に出力されることにより行なうものとすることができるし、コンピュータ10から単にURLを選択してカラーインクジェットプリンタ20に印刷要求することによっても行なうことができる。なお、コンピュータ10からのURL指定では、コンピュータ10によってもXHTML文書の解析やレイアウト,色変換や2値化などを行なうことができるが、コンピュータ10によってはこうした処理を一切行なわず、URLだけをカラーインクジェットプリンタ20に送信する場合となる。   Next, the operation of the color ink jet printer 20 of the embodiment configured as described above, particularly the operation when printing an XHTML document will be described. FIG. 2 is a flowchart illustrating an example of the analysis layout instruction process executed by the analysis unit 30. This process is repeatedly executed every predetermined time (for example, every 8 msec). When the analysis layout instruction process is executed, first, it is determined whether or not a URL (Uniform Resource Locator) for specifying an XHTML document is specified (step S100). If a URL is specified, the URL is stored in the memory. 50 is stored in the URL storage buffer area set in the area 50 (step S110), and if no URL is designated, the process proceeds to the next process. The URL designation is output to the color inkjet printer 20 from the digital television 12 when the operator selects an item to be printed by the color inkjet printer 20 among the printable items displayed on the digital television 12. Or by simply selecting a URL from the computer 10 and making a print request to the color inkjet printer 20. In the URL designation from the computer 10, the XHTML document can be analyzed, laid out, color converted, binarized, etc. by the computer 10, but the computer 10 does not perform such processing at all, and only the URL is colored. In this case, the data is transmitted to the ink jet printer 20.

続いて、メモリ50のURL格納用バッファ領域にURLが格納されているか否かを判定すると共に(ステップS120)、XHTML文書を現在解析中であるか否かを判定する(ステップS130)。XHTML文書を現在解析中であるか否かの判定は、この解析レイアウト指示処理と同時に並列に解析部30自身によって行なっているか否かを判定することにより、例えば解析開始時と解析終了時にフラグ操作するものとすればフラグを調べることにより行なうことができる。URLが格納されており、現在XHTML文書の解析中ではないときには、後述する解析処理により作成されるDOMツリーを格納するためのメモリ50のDOMツリー格納用領域やスタイルオブジェクトを格納するためのメモリ50のスタイルオブジェクト格納用領域に空きがあるか否かを判定し(ステップS140)、空きがあると判定されると、メモリ50のURL格納用バッファ領域に格納されている最初のURLを読み出してそのURLにより特定されるXHTML文書の解析を開始し(ステップS150)、URLが格納されていないときやURLが格納されていても現在XHTML文書を解析している最中のときや現在XHTML文書を解析している最中になくてもDOMツリー格納用領域やスタイルオブジェクト格納用領域に空きがないときには次の処理に進む。XHTML文書の解析は、図3に例示する解析処理に基づいて行なわれる。この解析処理ではURLにより特定されるXHTML文書が解析されてDOMツリーが作成され、XHTML文書に記述されたCSS文書を解析してスタイルオブジェクトが作成され、関連付けられてメモリ50のDOMツリー格納用領域とスタイルオブジェクト格納用領域とに記憶される。このとき、DOMツリーには識別情報としてDOMツリーIDが付与され、スタイルオブジェクトには識別情報としてスタイルオブジェクトIDが付与される。解析処理の詳細については後述する。   Subsequently, it is determined whether or not the URL is stored in the URL storage buffer area of the memory 50 (step S120), and whether or not the XHTML document is currently being analyzed is determined (step S130). Whether or not the XHTML document is currently being analyzed is determined by determining whether or not the analysis unit 30 itself performs in parallel with the analysis layout instruction processing, for example, at the start of analysis and at the end of analysis. If so, this can be done by checking the flag. When the URL is stored and the XHTML document is not currently being analyzed, the memory 50 for storing the DOM tree storage area and the style object in the memory 50 for storing the DOM tree created by the analysis processing described later. It is determined whether or not there is a space in the style object storage area (step S140). If it is determined that there is a space, the first URL stored in the URL storage buffer area of the memory 50 is read and Analysis of the XHTML document specified by the URL is started (step S150), and when the URL is not stored or when the XHTML document is currently being analyzed even if the URL is stored, the current XHTML document is analyzed. DOM tree storage area and style object storage area even if it is not Proceed to the next processing when there is no free. The analysis of the XHTML document is performed based on the analysis process illustrated in FIG. In this analysis process, the XHTML document specified by the URL is analyzed to create a DOM tree, the CSS document described in the XHTML document is analyzed to create a style object, and an associated DOM tree storage area in the memory 50 And the style object storage area. At this time, a DOM tree ID is assigned as identification information to the DOM tree, and a style object ID is assigned to the style object as identification information. Details of the analysis processing will be described later.

次に、レイアウタ38によってレイアウトが行なわれている最中であるか否かを判定し(ステップS160)、レイアウタ38によるレイアウトが行なわれてる最中にないときには、後述するレイアウト処理によりレイアウトされたページボックスを格納するためのメモリ50のボックス格納用領域に空きがあるか否かを判定し(ステップS170)、空きがあると判定されると、メモリ50のDOMツリー格納用領域に格納されたDOMツリーのうち最初のDOMツリーをDOMツリーIDを用いて指定してレイアウタ38にレイアウト開始指示を出力して(ステップS180)、この解析レイアウト指示処理を終了し、レイアウタ38によってレイアウトが行なわれている最中にあるときやレイアウトが行なわれている最中になくてもボックス格納用領域に空きがないときにはレイアウト開始指示を出力せずに解析レイアウト指示処理を終了する。ここで、レイアウタ38によってレイアウトが行なわれている最中にあるか否かの判定は、レイアウタ38からレイアウト終了の信号を入力したか否かにより行なうことができる。レイアウト終了の信号の受信についてはレイアウタ38の処理を説明する際に詳述する。   Next, it is determined whether or not the layout is being performed by the layouter 38 (step S160). If the layout is not being performed by the layouter 38, the page is laid out by a layout process to be described later. It is determined whether or not there is an empty box storage area of the memory 50 for storing boxes (step S170). If it is determined that there is an empty area, the DOM stored in the DOM tree storage area of the memory 50 is determined. The first DOM tree in the tree is designated using the DOM tree ID, a layout start instruction is output to the layouter 38 (step S180), the analysis layout instruction process is terminated, and the layout is performed by the layouter 38. Even if you are in the middle or not in the middle of the layout, It ends the analysis layout instruction process without outputting the layout start instruction when there is no free space at a box storage. Here, whether or not the layout is being performed by the layouter 38 can be determined based on whether or not a layout end signal is input from the layouter 38. The reception of the layout end signal will be described in detail when the processing of the layout 38 is described.

次に、解析部30により実行される解析処理について説明する。解析処理は、前述したように図3に例示するフローチャートに基づいて行なわれる。説明の容易のために、図4に例示するXHTML文書を用いて説明する。解析レイアウト指示処理によりURLを指定して解析開始の指示がなされると、URLにより特定されるXHTML文書を読み出し(ステップS200)、読み出したXHTML文書を解析してDOMツリーを作成する(ステップS210)。このとき、作成するDOMツリーには識別情報としてDOMツリーID(例えば、URLにDOMを付して作成したIDなど)を付与する。XHTML文書の読み出しは、具体的には、コア32がURLを指定してXMLパーサー34に解析依頼することによりXMLパーサー34が行なう。XHTML文書の解析およびDOMツリーの作成は、具体的には、XMLパーサー34がXHTML文書を最初から順に解析して各要素を作成すると共にDOMツリーに登録することにより行なう。なお、要素の作成はコア32に対して行ない、要素の登録はメモリ50のDOMツリー格納用領域に関連付けて格納することにより行なう。図4に例示したXHTML文書を解析して作成されたDOMツリーを図5に示す。   Next, analysis processing executed by the analysis unit 30 will be described. The analysis process is performed based on the flowchart illustrated in FIG. 3 as described above. For ease of explanation, description will be made using the XHTML document illustrated in FIG. When a URL is specified by the analysis layout instruction process and an analysis start instruction is given, the XHTML document specified by the URL is read (step S200), and the read XHTML document is analyzed to create a DOM tree (step S210). . At this time, a DOM tree ID (for example, an ID created by adding a DOM to a URL) is assigned as identification information to the DOM tree to be created. Specifically, the XHTML document is read by the XML parser 34 when the core 32 designates a URL and requests an analysis to the XML parser 34. Specifically, the analysis of the XHTML document and the creation of the DOM tree are performed by the XML parser 34 analyzing the XHTML document from the beginning in order to create each element and register it in the DOM tree. The element is created for the core 32, and the element is registered by associating it with the DOM tree storage area of the memory 50. FIG. 5 shows a DOM tree created by analyzing the XHTML document illustrated in FIG.

こうしてDOMツリーを作成すると、XHTML文書に指定されたCSS文書を読み出し(ステップS220)、読み出したCSS文書を解析してスタイルオブジェクトを作成する(ステップS230)。ここで、CSS文書は、その内容がXHTML文書に直接記述されたりXHTML文書の外部にリンクされたりして存在しており、図4の例では、XHTML文書にCSS文書の内容が直接記述されている場合を示した。CSS文書の読み出しは、具体的には、DOMツリーの各要素の初期化処理における依頼により依頼されたCSSPI36が行なう。CSS文書の内容がXHTML文書に直接記述されている場合には、XHTML文書中のCSS文書に該当する部分を渡してCSSPI36に依頼することにより行なわれ、CSS文書が外部にリンクされている場合には、linkタグ内のリンク先を指定してCSSPI36に依頼することにより行なわれる。CSS文書の解析およびスタイルオブジェクトの作成は、具体的には、CSSPI36がCSS文書を最初から順に解析して各ルールをメモリ50のスタイルオブジェクト格納用領域に格納することにより行なう。   When the DOM tree is created in this way, the CSS document designated as the XHTML document is read (step S220), and the read CSS document is analyzed to create a style object (step S230). Here, the content of the CSS document is described directly in the XHTML document or linked to the outside of the XHTML document. In the example of FIG. 4, the content of the CSS document is directly described in the XHTML document. Showed the case. Specifically, the CSS document 36 is read by the request in the initialization process of each element of the DOM tree. When the content of the CSS document is directly described in the XHTML document, the portion corresponding to the CSS document in the XHTML document is passed and requested to the CSSI 36, and the CSS document is linked to the outside. Is performed by specifying the link destination in the link tag and requesting it to the CSSI 36. Specifically, the CSS document is analyzed and the style object is created by the CSSI 36 analyzing the CSS document in order from the beginning and storing each rule in the style object storage area of the memory 50.

こうしてDOMツリーとスタイルオブジェクトが作成されると、作成したDOMツリーとスタイルオブジェクトの関連付け処理を実行し(ステップS240)、URL格納用バッファ領域から解析の対象のURLを削除して(ステップS250)、解析処理を終了する。   When the DOM tree and style object are created in this way, the created DOM tree and style object are associated with each other (step S240), and the URL to be analyzed is deleted from the URL storage buffer area (step S250). End the analysis process.

次に、レイアウタ38の処理について説明する。図6は、解析部30によりDOMツリーを指定してレイアウト開始指示がなされたときにレイアウタ38により実行されるレイアウト描画指示処理の一例を示すフローチャートである。レイアウト描画指示処理が実行されると、レイアウタ38は、まず、指定されたDOMツリーに基づいてレイアウトを開始する(ステップS300)。レイアウトは、図7に例示するレイアウト処理により実行される。説明の都合上、ここで、レイアウト描画指示処理の説明を一旦中断してレイアウト処理について説明する。   Next, processing of the layouter 38 will be described. FIG. 6 is a flowchart showing an example of a layout drawing instruction process executed by the layouter 38 when the analysis unit 30 designates a DOM tree and gives a layout start instruction. When the layout drawing instruction process is executed, the layouter 38 first starts layout based on the designated DOM tree (step S300). The layout is executed by the layout process illustrated in FIG. For convenience of explanation, the description of the layout drawing instruction processing will be interrupted here and the layout processing will be described.

レイアウト処理では、レイアウタ38は、まず、DOMツリーの各要素を順にサーチして要素毎にスタイル情報(要素に指定された特性や対応するスタイルオブジェクトのルール)が関連付けられた論理的なボックスとしての要素ボックスを作成する(ステップS400)。続いて、ページ毎に対応するページボックスを作成し(ステップS402)、要素ボックスをページボックスの下にレイアウト可能な領域(レイアウト可能領域)を取得する処理を行なう(ステップS404)。レイアウト可能領域の取得は、実施例では、レイアウト処理と同時に並列してレイアウタ38により図8に例示するレイアウト可能領域設定処理を実行することにより設定されメモリ50の所定領域に書き込まれたものを読み込むことにより行なわれる。図8のレイアウト可能領域設定処理では、図7のレイアウト処理の後述するステップS422の処理で要素ボックスとして浮動要素がレイアウトされたか否かを調べ(ステップS450)、浮動要素がレイアウトされていないときにはそのまま処理を終了し、浮動要素がレイアウトされたときにはその浮動要素のサイズを取得すると共に(ステップS452)、現在のレイアウト可能領域から浮動要素がレイアウトされた領域を除いて新たなレイアウト可能領域を設定する処理を行なって(ステップS454)、処理を終了する。図9に、浮動体Aや浮動体Bがレイアウトされた際にレイアウト可能領域がデータとしてメモリ50に書き込まれる様子を示し、図10に、浮動体Aがレイアウトされたときのブロックレイアウト可能領域の一例を示し、図11に、浮動体Aがレイアウトされたときにレイアウト可能領域設定処理により設定されるレイアウト可能領域の一例を示し、図12に、浮動体Aと浮動体Bとがレイアウトされたときにレイアウト可能領域設定処理により設定されるレイアウト可能領域の一例を示す。いま、始点(0,0),終点(Xp,Yp)の2点により定まる矩形領域のページボックスに始点(0,0),終点(X1,Y1)の2点により定まる矩形領域を有する浮動体Aがレイアウトされると共にこの浮動体Aがレイアウトされた後に始点(X1,0),終点(X2,Y2)の2点により定まる矩形領域を有する浮動体Bがレイアウトされた場合を考える。この場合、浮動体Aがレイアウトされる前は、ページボックスにレイアウトされた浮動体は存在しないから、レイアウト可能領域はページボックスの領域に設定されている(図9(a)参照)。浮動体Aがレイアウトされると、浮動体Aを包含する行の領域と浮動体Aを包含しない行の領域との2つの領域に分割され、2つのレイアウト可能領域が設定される(図9(b),図11参照)。このときでも、段落などのブロックをレイアウトする際には、浮動体はブロックのレイアウトに影響を与えないから、ブロックレイアウト可能領域は図10に示す領域となる。このとき、通常、表もブロックとして扱われるから、ブロックレイアウト可能領域に表をレイアウトすると、浮動体Aと表とが重ねてレイアウトされる場合が生じる。浮動体Aがレイアウトされた後に浮動体Bがレイアウトされると、図11(a)のレイアウト可能領域は浮動体Bを包含する行の領域と浮動体Bを包含しない行の領域の2つのレイアウト可能領域に分割され計3つのレイアウト可能領域が設定される(図9(c),図12参照)。こうして分割された複数のレイアウト可能領域は、行順(始点のY座標の値が小さい順)にソートされてメモリ50の所定領域に書き込まれる(図9(b),(c)参照)。ステップS404の処理は、こうしてメモリ50の所定領域に書き込まれたレイアウト可能領域のうち行が先頭(始点のY座標の値が最も小さい)のレイアウト可能領域を取得する処理となる。   In the layout process, the layouter 38 first searches each element of the DOM tree in order, and as a logical box in which style information (characteristics specified for the element and rules of the corresponding style object) is associated with each element. An element box is created (step S400). Subsequently, a page box corresponding to each page is created (step S402), and an element box is laid out under the page box (a layoutable area) is acquired (step S404). In the embodiment, the layout possible area is acquired by executing the layout possible area setting process illustrated in FIG. 8 by the layouter 38 in parallel with the layout process and reading the data written in the predetermined area of the memory 50. Is done. In the layout available area setting process of FIG. 8, it is checked whether or not the floating element is laid out as an element box in the process of step S422 described later of the layout process of FIG. 7 (step S450). When the process is finished and the floating element is laid out, the size of the floating element is acquired (step S452), and a new layoutable area is set by excluding the area where the floating element is laid out from the current layoutable area. Processing is performed (step S454), and the processing is terminated. FIG. 9 shows how the layable area is written as data in the memory 50 when the floating body A and the floating body B are laid out. FIG. 10 shows the block layout possible area when the floating body A is laid out. An example is shown, FIG. 11 shows an example of a layable area set by the layable area setting process when the floating body A is laid out, and FIG. 12 shows the floating body A and the floating body B laid out. An example of the layout possible area set by the layout possible area setting process is shown. Now, a floating body having a rectangular area defined by two points of a start point (0, 0) and an end point (X1, Y1) in a page box of a rectangular area defined by two points of a start point (0, 0) and an end point (Xp, Yp) Let us consider a case where A is laid out and a floating body B having a rectangular area defined by two points of a start point (X1, 0) and an end point (X2, Y2) is laid out after the floating body A is laid out. In this case, since the floating body laid out in the page box does not exist before the floating body A is laid out, the layable area is set to the page box area (see FIG. 9A). When the floating body A is laid out, it is divided into two areas, a row area that includes the floating body A and a row area that does not include the floating body A, and two layoutable areas are set (FIG. 9 ( b), see FIG. Even at this time, when a block such as a paragraph is laid out, the floating body does not affect the layout of the block, so the block layout possible area is an area shown in FIG. At this time, since the table is usually handled as a block, when the table is laid out in the block layout possible area, the floating body A and the table may be laid out in an overlapping manner. When the floating body B is laid out after the floating body A is laid out, the layoutable area in FIG. 11A has two layouts: a row area including the floating body B and a row area not including the floating body B. Divided into possible areas, a total of three possible layout areas are set (see FIGS. 9C and 12). The plurality of layout available areas divided in this way are sorted in line order (in order of decreasing Y coordinate value of the starting point) and written to a predetermined area of the memory 50 (see FIGS. 9B and 9C). The process of step S404 is a process of acquiring a layout available area whose row is at the head (the Y coordinate value of the starting point is the smallest) among the layout available areas written in the predetermined area of the memory 50 in this way.

こうしてレイアウト可能領域を取得すると、対象となる要素ボックスが表要素であるか否かを調べ(ステップS406)。要素ボックスが表要素であると判定されたときには、表の構成を解析してスタイル情報に基づいてレイアウトする表の行に含まれるセルの列幅の合計、即ち表の幅を設定し(ステップS408)、試行数Nを値1に設定(初期化)すると共に(ステップS410)、設定した表の幅がレイアウト可能領域の幅に収まるか否かを判定する(ステップS412)。セルの列幅の設定は、実施例では、セルの内容(テキストや画像のサイズなど)に依存しないでセルの列幅の設定を行なう固定表組み(table−layout特性が「fixed」)と、セルの内容に依存してセルの列幅の設定を行なう自動表組み(table−layout特性が「auto」)との二通りがある。固定表組みにおけるセルの列幅の設定は、基本的には、最初の行のセルの幅に関する特性(width特性)を調べてwidth特性が「auto」以外、即ち、何らかの値(絶対的な長さやレイアウト可能領域の幅に対する割合)が指定されているセルについては、その指定された値を該当するセルの列幅として設定し、width特性が「auto」に指定されているセルについては、width特性が「auto」以外に指定された前述のセルについて設定した列幅の合計(境界やセル間のスペースも加えた幅)とレイアウト可能領域の幅との偏差の幅をwidth特性に「auto」が指定された残りのセルに配分(例えば、均等配分)することにより行なわれる。一方、自動表組みにおけるセルの列幅の設定は、基本的には、レイアウト可能領域の幅の範囲でセルの内容をできる限り一行でレイアウトするよう各セルの列幅を設定し、列幅が指定されたセルについてはその指定された列幅を設定することにより行なわれる。こうして設定された表の幅が取得したレイアウト可能領域の幅に収まると判定されると、このレイアウト可能領域に設定した表の幅に従ってセルをレイアウトする(ステップS422)。一方、表の幅が取得したレイアウト可能領域の幅に収まらないと判定されると、試行数Nを値1だけインクリメントすると共に(ステップS414)、試行数Nが値2よりも大きいか否かを判定し(ステップS416)、試行数Nが値2よりも大きくない、即ち値2以下と判定されると、次の行のレイアウト可能領域、即ち、始点のY座標の値が次に小さいレイアウト可能領域を取得して(ステップS418)、ステップS408で設定した表の幅が取得したレイアウト可能領域の幅に収まるか否かを判定する処理を繰り返す(ステップS412)。試行数Nが値2よりも大きいと判定されると、クリア(clear)特性を適用してレイアウト可能領域を取得、即ち、始点のY座標の値が最も大きいレイアウト可能領域を取得し(ステップS420)、取得したレイアウト可能領域で表をレイアウトする処理を行なう(ステップS422)。なお、レイアウトの最中にレイアウトボックスがページボックスのページ境界をオーバーしてこれ以上登録できないときには、改ページの判定がなされ(ステップS424)、次ページのページボックスが作成されて残余の要素ボックスに対してレイアウト処理が開始される。   When the layout possible area is acquired in this way, it is checked whether or not the target element box is a table element (step S406). If it is determined that the element box is a table element, the table structure is analyzed, and the total column width of the cells included in the table row to be laid out based on the style information, that is, the table width is set (step S408). ) The number of trials N is set to 1 (initialized) (step S410), and it is determined whether or not the set table width is within the width of the layout available area (step S412). In the embodiment, the setting of the cell column width is a fixed table set (table-layout characteristic is “fixed”) for setting the column width of the cell without depending on the cell contents (text or image size). There are two ways of automatic table composition (table-layout characteristic is “auto”) for setting the cell column width depending on the cell contents. The column width of the cell in the fixed table is basically set by checking the characteristic (width characteristic) regarding the cell width of the first row, and the width characteristic is other than “auto”, that is, some value (absolute length). For cells for which the ratio of the ratio to the width of the layoutable area) is specified, the specified value is set as the column width of the corresponding cell, and for the cell whose width characteristic is specified as “auto”, the width is set. The width of the deviation between the total column width (width including the boundary and the space between cells) set for the above-mentioned cell whose characteristics are specified other than “auto” and the width of the layout possible area is set to “auto”. Is performed by distributing (for example, even distribution) to the remaining designated cells. On the other hand, the setting of the cell column width in the automatic table layout is basically to set the column width of each cell so that the cell contents are laid out in one line as much as possible within the range of the layout possible area. For a specified cell, this is done by setting the specified column width. If it is determined that the width of the table set in this way falls within the width of the acquired layout available area, the cell is laid out according to the width of the table set in the layout available area (step S422). On the other hand, if it is determined that the width of the table does not fit within the width of the acquired layout possible area, the number of trials N is incremented by 1 (step S414), and whether or not the number of trials N is greater than 2 is determined. If it is determined (step S416) and it is determined that the number of trials N is not greater than the value 2, that is, the value is 2 or less, the layout is possible in the next row, that is, the Y coordinate value of the starting point is the next smallest. An area is acquired (step S418), and the process of determining whether or not the width of the table set in step S408 is within the width of the acquired layout possible area is repeated (step S412). If it is determined that the number of trials N is greater than the value 2, a layoutable area is obtained by applying a clear characteristic, that is, a layoutable area having the largest Y coordinate value is obtained (step S420). ), A process of laying out the table in the obtained layout available area is performed (step S422). If the layout box exceeds the page boundary of the page box and cannot be registered any more during layout, the page break is determined (step S424), the page box for the next page is created, and the remaining element box is displayed. On the other hand, layout processing is started.

例えば、図12に例示するように、二つの浮動体A,Bがレイアウトされたページボックスに表をレイアウトする際、まず、図12(a)のレイアウト可能領域を取得して表の幅がレイアウト可能領域の幅に収まるか否かを調べ、表の幅がレイアウト可能領域の幅に収まらないと判定されると、試行数Nを値1だけインクリメントして(N=2)次の行のレイアウト可能領域、即ち図12(b)のレイアウト可能領域を取得し、再び表の幅がレイアウト可能領域の幅に収まるか否かを調べる。このレイアウト可能領域にも表の幅が収まらないと判定されると、試行数N2を更に値1だけインクリメントするが、このとき試行数Nは値2よりも大きくなるから、クリア(Clear)特性が適用されて浮動体A,Bを共に包含しない行のレイアウト可能領域を取得して、この取得したレイアウト可能領域に表をレイアウトするのである。このように、浮動体を除いたレイアウト可能領域を設定して表をレイアウトことにより、浮動体と表とが重ねてレイアウトされてその内容が欠落するのを防止しているのである。   For example, as illustrated in FIG. 12, when a table is laid out in a page box in which two floating bodies A and B are laid out, first, the layout possible area in FIG. It is checked whether or not the width of the table is within the width of the possible area. If it is determined that the width of the table does not fit within the width of the layout area, the number N of trials is incremented by 1 (N = 2) The possible area, that is, the layout possible area in FIG. 12B is acquired, and it is checked again whether or not the width of the table falls within the width of the layout possible area. If it is determined that the width of the table does not fit in this layout possible area, the number of trials N2 is further incremented by the value 1, but at this time, the number of trials N becomes larger than the value 2, so that the clear characteristic is clear. The layoutable area of the row that is applied and does not include both the floating bodies A and B is acquired, and the table is laid out in the acquired layoutable area. In this way, by setting the layout possible area excluding the floating body and laying out the table, the floating body and the table are laid out in an overlapping manner to prevent the contents from being lost.

ステップS406で要素ボックスが表要素以外の要素であると判定されたときにはスタイル情報に基づいてレイアウトボックスを作成してページボックスの下にレイアウトできなくなるまで要素の内容をレイアウトする(ステップS422)。要素ボックスが浮動要素であるときには、右詰め(right)か左詰め(left)かのいずれかの指定によって、ページボックスの辺と他の浮動体(ボックス)の辺のいずれかに接触するまで右または左に詰められてレイアウトされる。浮動体がレイアウトされると前述した図8のレイアウト可能領域設定処理によりレイアウトされた浮動体の領域を除く新たなレイアウト可能領域が設定されることになる。要素の内容のレイアウトは、例えば、要素の内容がイメージの場合には、画像サイズを取得してイメージボックスを作成すると共にレイアウトボックスとしての行を作成してイメージボックスを行に登録することにより行なわれ、要素の内容がテキストの場合には、行を作成し、行に入るだけのテキストボックスを作成して行に登録することを繰り返すことにより行なわれる。取得した画像サイズによりイメージボックスをレイアウトできなかったり、テキストのすべてを登録することができないときには、改ページの判定がなされ(ステップS424)、次ページに対応するページボックスが作成され、レイアウトできなかったイメージボックスや残りのテキストを行に登録する。   When it is determined in step S406 that the element box is an element other than the table element, a layout box is created based on the style information, and the contents of the element are laid out until it cannot be laid out under the page box (step S422). When the element box is a floating element, it is right until it touches either the edge of the page box or the edge of another floating body (box) by specifying either right-justification (right) or left-justification (left). Or laid out on the left. When the floating body is laid out, a new layout possible area is set excluding the floating area laid out by the layout possible area setting process of FIG. 8 described above. For example, when the content of an element is an image, the layout of the element contents is performed by acquiring the image size and creating an image box and creating a line as a layout box and registering the image box in the line. If the content of the element is text, it is performed by repeatedly creating a line, creating a text box sufficient to enter the line, and registering it in the line. When the image box cannot be laid out due to the acquired image size or all of the text cannot be registered, page break is determined (step S424), and a page box corresponding to the next page is created and cannot be laid out. Register the image box and the rest of the text on the line.

こうしてすべての要素ボックスに対してレイアウトが完了すると(ステップS426)、指定されたDOMツリーをメモリ50のDOMツリー格納用領域から削除すると共に(ステップS428)、レイアウト終了を解析部30に出力して(ステップS430)、レイアウト処理を終了する。これにより、解析部30により作成される新たなDOMツリーの格納領域が確保される。   When the layout is completed for all the element boxes (step S426), the designated DOM tree is deleted from the DOM tree storage area of the memory 50 (step S428), and the layout end is output to the analysis unit 30. (Step S430), the layout process ends. Thereby, a storage area for a new DOM tree created by the analysis unit 30 is secured.

レイアウト描画指示処理(図6)の説明に戻る。レイアウトを開始すると、最初のページ分のレイアウトが完了するのを待って(ステップS310)、レイアウトが完了したページを指定してRPI40に描画開始指示を出力する(ステップS320)。ページ分のレイアウトが完了したか否かの判定は、次ページに対応するページボックスが作成されたか否かにより、1ページだけしかないときにはレイアウト処理が終了したか否かにより行なうことができる。描画開始指示されたRPI40は、図13に例示する描画処理を実行し、ページボックスに従ってテキストや画像をメモリ50の印刷用画像格納領域を用いてRGBデータとして描画し(ステップS500)、描画が終了したときに色変換部42に色変換指示を出力すると共に(ステップS510)、描画終了をレイアウタ38に出力する(ステップS520)。なお、画像の描画については、画像ファイルを読み出し、ファイル形式によっては展開等を行なって描画する。図14に、図4に例示するXHTML文書中の浮動要素と表要素とを解析した場合の印刷結果を示す説明図を示す。浮動体画像を包含する行の領域のうち浮動体画像の領域を除いたレイアウト可能領域に表をレイアウトできないときには(図14(a)参照)、浮動体画像を包含しない行の領域に行替えしたレイアウト可能領域に表がレイアウトされる(図14(b)参照)。   Returning to the description of the layout drawing instruction process (FIG. 6). When the layout is started, it waits for the layout of the first page to be completed (step S310), specifies the page for which the layout has been completed, and outputs a drawing start instruction to the RPI 40 (step S320). Whether or not the layout for the page has been completed can be determined based on whether or not the page box corresponding to the next page has been created and whether or not the layout processing has been completed when there is only one page. The RPI 40 instructed to start drawing executes the drawing process illustrated in FIG. 13 and draws text and images as RGB data using the print image storage area of the memory 50 according to the page box (step S500), and the drawing is completed. When this is done, a color conversion instruction is output to the color conversion unit 42 (step S510), and a drawing end is output to the layouter 38 (step S520). For image drawing, an image file is read and, depending on the file format, is developed and drawn. FIG. 14 is an explanatory diagram showing a print result when a floating element and a table element in the XHTML document illustrated in FIG. 4 are analyzed. When the table cannot be laid out in the layoutable area excluding the floating image area in the line area including the floating body image (see FIG. 14A), the line area is changed to a line area not including the floating body image. A table is laid out in the layout available area (see FIG. 14B).

描画開始指示を出力した後はそのページの描画が終了するのを待って(ステップS330)、そのページに対応するページボックスを削除する(ステップS340)。このように、ページの描画が終了する毎にそのページに対応するページボックスを削除することにより、ボックス格納用領域に不要なページボックスが格納された状態が継続されるのを回避することができる。こうしてページボックスを削除すると、次ページがあるか否かを判定し(ステップS350)、次ページがあるときにはステップS310の処理に戻る。即ち、次ページに対するページ分のレイアウトが完了しているか否かを判定し、レイアウトが完了していないときには完了するまで待ってレイアウトが完了したページを指定してRPI40に描画開始指示を出力するのである。こうしてすべてのページを描画し、次ページがなくなると、レイアウト描画指示処理を終了する。   After outputting the drawing start instruction, it waits for the drawing of the page to end (step S330), and deletes the page box corresponding to the page (step S340). Thus, by deleting the page box corresponding to the page every time drawing of the page is completed, it is possible to avoid the state where unnecessary page boxes are stored in the box storage area. . When the page box is deleted in this way, it is determined whether or not there is a next page (step S350). If there is a next page, the process returns to step S310. That is, it is determined whether or not the layout for the next page has been completed. If the layout has not been completed, the process waits until the layout is completed, specifies the page for which the layout has been completed, and outputs a drawing start instruction to the RPI 40. is there. In this way, all the pages are drawn, and when there is no next page, the layout drawing instruction process is terminated.

以上説明した実施例のカラーインクジェットプリンタ20によれば、浮動体が含まれるレイアウトボックス内に表をレイアウトするとき、浮動体の領域を除くレイアウト可能領域を取得して表をレイアウトするから、浮動体と表とが重なった状態で印刷されるのを防止することができる。しかも、浮動体が包含する行のボックスに表をレイアウトしようとすると、表の幅がレイアウト可能領域の幅に収まらないときには、その浮動体が包含しない行に行替えしたレイアウト可能領域を再取得して表をレイアウトするから、その内容の欠落をより確実に防止して表をレイアウトして印刷することができる。さらに、レイアウト可能領域の取得の回数(試行数N)が値2よりも大きくなったときに、クリア(clear)特性を適用して浮動体が全く含まれない行のレイアウト可能領域を取得して表をレイアウトするから、レイアウト処理の負荷が過剰となるのを抑制できる。   According to the color ink jet printer 20 of the embodiment described above, when a table is laid out in a layout box including a floating body, a layoutable area excluding the floating area is acquired and the table is laid out. Can be prevented from being printed in the state where the front and the front are overlapped. In addition, if you attempt to lay out a table in a box with a row that the floating body contains, if the width of the table does not fit within the width of the layoutable area, the layoutable area that has been changed to a row that the floating body does not contain is reacquired. Since the table is laid out, it is possible to lay out the table and print it while preventing the content from being lost more reliably. Further, when the number of layoutable area acquisitions (number of trials N) is greater than the value 2, the clear characteristic is applied to acquire a layoutable area of a line that does not include any floating body. Since the table is laid out, an excessive load of layout processing can be suppressed.

ここで、実施例のカラーインクジェットプリンタ20のコア32とXMLパーサー34とCSSPI36とからなる解析部30が解析手段に相当し、レイアウタ38がレイアウト手段に相当し、RPI40と色変換部42と2値化部44とイメージバッファ46と印刷実行部48とが出力手段に相当する。   Here, the analysis unit 30 including the core 32, the XML parser 34, and the CSSPI 36 of the color inkjet printer 20 of the embodiment corresponds to the analysis unit, the layouter 38 corresponds to the layout unit, the RPI 40, the color conversion unit 42, and the binary value. The conversion unit 44, the image buffer 46, and the print execution unit 48 correspond to output means.

実施例のカラーインクジェットプリンタ20では、試行数Nが値2を越えたときにクリア(clear)特性を適用したレイアウト可能領域を取得して表をレイアウトするものとしたが、試行数Nが値1あるいは値3以上の値を越えたときにクリア特性を適用したレイアウト可能領域(始点のY座標が最も大きいレイアウト可能領域)を取得して表をレイアウトするものとしてもよい。なお、試行数Nが値1を越えたときにクリア特性を適用する場合では、図7のステップS414〜S418の処理は実行する必要がない。   In the color inkjet printer 20 of the embodiment, when the number of trials N exceeds the value 2, the layout possible area to which the clear characteristic is applied is acquired and the table is laid out. Alternatively, the table may be laid out by acquiring a layoutable area (a layoutable area having the largest Y coordinate of the starting point) to which the clear characteristic is applied when a value of 3 or more is exceeded. When the clear characteristic is applied when the number of trials N exceeds the value 1, it is not necessary to execute the processes of steps S414 to S418 in FIG.

実施例のカラーインクジェットプリンタ20では、構造化文書としてXHTMLで記述された文書を解析して印刷するものとしたが、他のマークアップ言語により記述された文書を解析して印刷するものとしてもよい。また、マークアップ言語以外の言語により記述された文書を解析して印刷するものとしても差し支えない。   In the color inkjet printer 20 of the embodiment, a document described in XHTML as a structured document is analyzed and printed. However, a document described in another markup language may be analyzed and printed. . In addition, a document described in a language other than the markup language may be analyzed and printed.

実施例のカラーインクジェットプリンタ20では、入力インタフェース22に接続される機器としてコンピュータ10やデジタルテレビ12やデジタルカメラ14などを挙げたが、如何なる機器を接続するものとしても差し支えない。   In the color inkjet printer 20 of the embodiment, the computer 10, the digital television 12, the digital camera 14, and the like are cited as devices connected to the input interface 22, but any device may be connected.

実施例では、XHTML文書を解析して印刷するカラーインクジェットプリンタを用いて説明したが、カラーレーザプリンタやモノクロのインクジェットプリンタやレーザープリンタなどの種々のプリンタを用いるものとしてもよい。また、こうしたプリンタ以外に、XHTML文書を解析して出力(例えば、表示出力)する通常のコンピュータに用いるものとしても差し支えない。   In the embodiment, a color ink jet printer that analyzes and prints an XHTML document has been described, but various printers such as a color laser printer, a monochrome ink jet printer, and a laser printer may be used. In addition to such a printer, the printer may be used for an ordinary computer that analyzes and outputs an XHTML document (for example, display output).

以上、本発明を実施するための最良の形態について実施例を用いて説明したが、本発明はこうした実施例に何等限定されるものではなく、本発明の要旨を逸脱しない範囲内において、種々なる形態で実施し得ることは勿論である。   The best mode for carrying out the present invention has been described with reference to the embodiments. However, the present invention is not limited to these embodiments, and various modifications can be made without departing from the gist of the present invention. Of course, it can be implemented in the form.

本発明は、印刷機器産業やコンピュータ産業などの産業に利用可能である。   The present invention is applicable to industries such as the printing equipment industry and the computer industry.

実施例のカラーインクジェットプリンタ20の構成の概略を示す構成図。1 is a configuration diagram illustrating an outline of a configuration of a color inkjet printer 20 according to an embodiment. 解析レイアウト指示処理の一例を示すフローチャート。The flowchart which shows an example of an analysis layout instruction | indication process. 解析処理の一例を示すフローチャート。The flowchart which shows an example of an analysis process. 具体例のXHTML文書の一例を示す説明図。Explanatory drawing which shows an example of the XHTML document of a specific example. 具体例のDOMツリーの一例を示す説明図。Explanatory drawing which shows an example of the DOM tree of a specific example. レイアウト描画指示処理の一例を示す説明図。Explanatory drawing which shows an example of a layout drawing instruction | indication process. レイアウト処理の一例を示す説明図。Explanatory drawing which shows an example of a layout process. レイアウト可能領域設定処理の一例を示す説明図。Explanatory drawing which shows an example of a layout possible area | region setting process. レイアウト可能領域がデータとしてメモリ50に書き込まれる様子を説明する説明図。Explanatory drawing explaining a mode that a layout possible area | region is written in the memory 50 as data. 浮動体Aがレイアウトされたときのブロックレイアウト可能領域の一例を示す説明図。Explanatory drawing which shows an example of a block layout possible area | region when the floating body A is laid out. 浮動体Aがレイアウトされたときにレイアウト可能領域設定処理により設定されるレイアウト可能領域の一例を示す説明図。Explanatory drawing which shows an example of the layout possible area | region set by the layout possible area | region setting process when the floating body A is laid out. 浮動体A,Bがレイアウトされたときにレイアウト可能領域設定処理により設定されるレイアウト可能領域の一例を示す説明図。Explanatory drawing which shows an example of the layout possible area | region set by the layout possible area | region setting process when the floating bodies A and B are laid out. 描画処理の一例を示す説明図。Explanatory drawing which shows an example of a drawing process. 印刷結果の一例を示す説明図。Explanatory drawing which shows an example of a printing result.

符号の説明Explanation of symbols

10 コンピュータ、12 デジタルテレビ、14 デジタルカメラ、20 カラーインクジェットプリンタ、22 入力インターフェース、24 信号処理部、30 解析部、32 コア、34 XMLパーサー、36 CSSPI、38 レイアウタ、40 RPI、42 色変換部、44 2値化部、46 イメージバッファ、48 印刷実行部、50 メモリ。   10 computers, 12 digital televisions, 14 digital cameras, 20 color inkjet printers, 22 input interfaces, 24 signal processing units, 30 analysis units, 32 cores, 34 XML parsers, 36 CSSPIs, 38 layouters, 40 RPIs, 42 color conversion units, 44 binarization unit, 46 image buffer, 48 print execution unit, 50 memory.

Claims (10)

所定の言語で記述された構造化文書を解析して出力する文書解析装置であって、
前記構造化文書が指定されたとき、該指定された構造化文書を受け付けて解析する解析手段と、
該解析した構造化文書中に含まれる要素を順次レイアウトし、該構造化文書中に浮動要素が含まれると共に該浮動要素がレイアウトされる行と同一の行の領域にレイアウトされる表要素が含まれるときには、該表要素が該浮動要素に重ならないよう該表要素をレイアウトするレイアウト手段と、
該レイアウトされた要素を描画して出力する出力手段と
を備える文書解析装置。
A document analysis device that analyzes and outputs a structured document described in a predetermined language,
When the structured document is designated, an analysis means for accepting and analyzing the designated structured document;
The elements included in the analyzed structured document are sequentially laid out, and the structured document includes a floating element and a table element that is laid out in an area of the same line as the line on which the floating element is laid out. Layout means for laying out the table element such that the table element does not overlap the floating element;
A document analysis apparatus comprising: output means for drawing and outputting the laid out elements.
前記レイアウト手段は、前記浮動要素がレイアウトされる行の領域のうち該浮動要素の領域を除いたレイアウト可能領域を設定し、該設定したレイアウト可能領域に前記表要素をレイアウトする手段である請求項1記載の文書解析装置。   The layout means is means for setting a layable area excluding the floating element area in a row area where the floating element is laid out, and laying out the table element in the set layable area. 1. The document analysis apparatus according to 1. 前記レイアウト手段は、前記設定したレイアウト可能領域に前記表要素をレイアウトできないときには、前記浮動要素を包含しない行まで行替えしてレイアウト可能領域を設定し、該設定したレイアウト可能領域に該表要素をレイアウトする手段である請求項2記載の文書解析装置。   When the table element cannot be laid out in the set layable area, the layout unit sets a layable area by changing to a line that does not include the floating element, and puts the table element in the set layable area. The document analysis apparatus according to claim 2, wherein the document analysis apparatus is a layout unit. 前記レイアウト手段は、同一の行の領域に複数の浮動要素がレイアウトされたときに該複数の浮動要素により複数のレイアウト可能領域が設定されたとき、前記表要素がレイアウト可能となるまで所定回数に亘って順にレイアウト可能領域を替えて該表要素をレイアウトする処理を繰り返し、該所定回数に亘ってレイアウト可能領域を替えたにも拘わらず該表要素が該複数のレイアウト可能領域のいずれにもレイアウトできないときには、該複数の浮動要素のすべてを包含しない行のレイアウト可能領域を設定し、該設定したレイアウト可能領域に該表要素をレイアウトする手段である請求項3記載の文書解析装置。   The layout means performs a predetermined number of times until the table element can be laid out when a plurality of layable areas are set by the plurality of floating elements when a plurality of floating elements are laid out in the same row area. The table element is laid out in any of the plurality of layout possible areas in spite of changing the layout possible area over the predetermined number of times. 4. The document analyzing apparatus according to claim 3, wherein when it is impossible, a layout possible area of a line that does not include all of the plurality of floating elements is set, and the table element is laid out in the set layout possible area. 前記所定回数は、1回または2回である請求項4記載の文書解析装置。   The document analysis apparatus according to claim 4, wherein the predetermined number of times is once or twice. 前記構造化文書は、前記所定の言語としてマークアップ言語により記述された文書である請求項1ないし5いずれか記載の文書解析装置。   6. The document analysis apparatus according to claim 1, wherein the structured document is a document described in a markup language as the predetermined language. 前記マークアップ言語は、XHTMLである請求項6記載の文書解析装置。   The document analysis apparatus according to claim 6, wherein the markup language is XHTML. 請求項1ないし7いずれか記載の文書解析装置を備える印刷装置。   A printing apparatus comprising the document analysis apparatus according to claim 1. 所定の言語で記述された構造化文書を解析して出力する文書解析方法であって、
(a)前記構造化文書が指定されたとき、該指定された構造化文書を受け付けて解析し、
(b)該解析した構造化文書中に含まれる要素を順次レイアウトし、該構造化文書中に浮動要素が含まれると共に該浮動要素がレイアウトされる行と同一の行の領域にレイアウトされる表要素が含まれるときには、該表要素が該浮動要素に重ならないよう該表要素をレイアウトし、
(c)該レイアウトされた要素を描画して出力する
文書解析方法。
A document analysis method for analyzing and outputting a structured document described in a predetermined language,
(A) When the structured document is designated, the designated structured document is received and analyzed;
(B) A table in which elements included in the analyzed structured document are sequentially laid out and a floating element is included in the structured document and is laid out in an area on the same line as the line on which the floating element is laid out. When an element is included, lay out the table element so that the table element does not overlap the floating element;
(C) A document analysis method for drawing and outputting the laid out elements.
所定の言語で記述された構造化文書を解析して出力する文書解析装置に用いられるプログラムであって、
前記構造化文書が指定されたとき、該指定された構造化文書を受け付けて解析するモジュールと、
該解析した構造化文書中に含まれる要素を順次レイアウトし、該構造化文書中に浮動要素が含まれると共に該浮動要素がレイアウトされる行と同一の行の領域にレイアウトされる表要素が含まれるときには、該表要素が該浮動要素に重ならないよう該表要素をレイアウトするモジュールと、
該レイアウトされた要素を描画して出力するモジュールと
を備えるプログラム。
A program used in a document analysis apparatus that analyzes and outputs a structured document described in a predetermined language,
A module that accepts and analyzes the designated structured document when the structured document is designated;
The elements included in the analyzed structured document are sequentially laid out, and the structured document includes a floating element and a table element that is laid out in an area of the same line as the line on which the floating element is laid out. A module that lays out the table element such that the table element does not overlap the floating element;
A module for drawing and outputting the laid-out elements.
JP2004013072A 2004-01-21 2004-01-21 Document analysis device and method, program for document analysis device, and printer Pending JP2005208810A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2004013072A JP2005208810A (en) 2004-01-21 2004-01-21 Document analysis device and method, program for document analysis device, and printer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2004013072A JP2005208810A (en) 2004-01-21 2004-01-21 Document analysis device and method, program for document analysis device, and printer

Publications (1)

Publication Number Publication Date
JP2005208810A true JP2005208810A (en) 2005-08-04

Family

ID=34899267

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2004013072A Pending JP2005208810A (en) 2004-01-21 2004-01-21 Document analysis device and method, program for document analysis device, and printer

Country Status (1)

Country Link
JP (1) JP2005208810A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008021087A (en) * 2006-07-12 2008-01-31 Seiko Epson Corp Document-editing device and program

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008021087A (en) * 2006-07-12 2008-01-31 Seiko Epson Corp Document-editing device and program

Similar Documents

Publication Publication Date Title
JP2005131915A (en) Printing apparatus, printing method and program for printing apparatus
US20110075165A1 (en) Image processing system, image processing method and computer readable medium
JP2004318581A (en) Information processor and method of displaying print preview
CN101951452A (en) Printing state set device, method, system and storage medium
JP2009151571A (en) Image data supply device and method
US8014031B2 (en) Formation of picture image having gradation expressed by fill area and one-line image data
US20050036170A1 (en) Image processing apparatus and image forming apparatus
CN102331914A (en) Form processing system, ocr device, form creation device, and form procrssing method
JP2012232590A (en) System and program for forming image
US20080310719A1 (en) Image processing apparatus, image processing method, and storage medium
JP4438380B2 (en) Printing apparatus, printing method, and program for printing apparatus
US20100328716A1 (en) Print processing apparatus and control method
JP2005208723A (en) Printing apparatus and medium type setting method
JP6904717B2 (en) Image processing equipment, its control method, and programs
JP2007193660A (en) Information management device, information management method and program therefor
JP4449398B2 (en) Printing apparatus, printing method, and program for printing apparatus
JP2005208810A (en) Document analysis device and method, program for document analysis device, and printer
JP5915091B2 (en) Image forming apparatus, image forming system, output image data processing method, program, and recording medium
JP2005208809A (en) Document analysis device and method, program for document analysis device, and printer
JP4165366B2 (en) Document analysis apparatus and method, program for document analysis apparatus, and printing apparatus
US20060092454A1 (en) Printing device and printing method
JP4599950B2 (en) Processing apparatus and processing method
JP2005246796A (en) Printing device and its printing method
JP2005111795A (en) Printer, printing method and program for printer
JP5228543B2 (en) Print job processing system and print job processing method