WO2013097805A1 - 双向排版方法和设备 - Google Patents

双向排版方法和设备 Download PDF

Info

Publication number
WO2013097805A1
WO2013097805A1 PCT/CN2012/088012 CN2012088012W WO2013097805A1 WO 2013097805 A1 WO2013097805 A1 WO 2013097805A1 CN 2012088012 W CN2012088012 W CN 2012088012W WO 2013097805 A1 WO2013097805 A1 WO 2013097805A1
Authority
WO
WIPO (PCT)
Prior art keywords
character
reverse
reversed
typesetting
characters
Prior art date
Application number
PCT/CN2012/088012
Other languages
English (en)
French (fr)
Inventor
唐耀珺
杨燕菲
Original Assignee
北大方正集团有限公司
北京北大方正电子有限公司
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 北大方正集团有限公司, 北京北大方正电子有限公司 filed Critical 北大方正集团有限公司
Priority to US14/130,237 priority Critical patent/US9613005B2/en
Publication of WO2013097805A1 publication Critical patent/WO2013097805A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/126Character encoding
    • G06F40/129Handling non-Latin characters, e.g. kana-to-kanji conversion
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents
    • G06F40/109Font handling; Temporal or kinetic typography
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/197Version control

Definitions

  • the invention belongs to the field of typesetting technology, and particularly relates to a two-way typesetting method and device. Background technique
  • Different languages have different reading directions, such as Chinese, English, Latin, etc., which are usually read (written) from left to right, while Weiwen, Arabic, Hebrew, etc. usually read (write) from right to left; therefore, Different languages should use different layout directions (that is, the relationship between the order of input characters and the position of characters after layout) so that the display order is different in newspapers, books, and the like.
  • the format change (such as folding, etc.) when constructing a large sample is prone to errors, such as the above example of "Beijing Peking University Founder Electronics", if the first line in the large sample remains The space can only accommodate 5 Chinese characters, then the existing two-way typesetting method will use the reversed order and the next order of the "child electric square" 5 words in the first line of the large sample in the right-to-left layout direction.
  • Characters usually refer to the smallest text unit that can be input into an electronic device, including text characters (such as a Chinese character, an English letter, etc.), symbol characters (commas, periods, etc.), format characters (such as line breaks, etc.); Refers to the file used in the layout process mainly including the content of the document (such as the specific characters, the order of characters, etc.); and the large sample usually refers to the information obtained by the sample, including the layout location information (such as where a character is located, etc.)
  • the file used in the typesetting process where the position of the character can be represented by a row index (ie, where the character is located), a position index (where the character is located in the line), and the like.
  • An aspect of the present application provides a two-way typesetting method.
  • the method may include: obtaining a sample formed by bidirectionally formatting a document;
  • the apparatus can include a large construction unit for constructing a large sample, wherein the large construction unit includes:
  • a reverse sequence determining unit configured to determine at least one reverse sequence consisting of consecutive characters requiring reverse ordering from a sample formed by bidirectionally formatting the document when constructing the large sample;
  • a reverse order determining unit configured to determine the reverse order of the characters that need to be reversed in the text The location in the file will be located, and the location will be recorded in the large sample.
  • Another aspect of the present application provides a computer readable storage medium having stored in the storage medium:
  • the "character position" is directly reversed when constructing the large sample; therefore, on the one hand, the meaning and order of the contents stored in the sample are Both are correct, easy to exchange data, and easy to operate; on the other hand, when constructing a large sample, the exact position after the character is reversed can be directly determined, and no error is caused by the format change, and the layout result is accurate.
  • the present invention is particularly applicable to a layout of documents having different reading directions in the same paragraph, such as a document containing both Chinese and Weiwen in one paragraph, and documents containing both English and Arabic.
  • Figure 1 is a schematic diagram of the correct typesetting result of the existing two-way typesetting method
  • FIG. 2 is a schematic diagram of an error layout of a conventional two-way typesetting method when folding
  • FIG. 3 is a block diagram of a two-way typesetting apparatus according to an embodiment of the present application.
  • FIG. 4 is a flow chart of a two-way typesetting method according to an embodiment of the present application.
  • FIG. 5 is a schematic diagram of a typesetting result formed according to the method shown in FIG. detailed description
  • FIG. 3 illustrates a two-way typesetting device 300 in accordance with one embodiment of the present application.
  • the device 300 includes at least a sample generation unit 301 and a large sample construction unit 302.
  • the sample generating unit 301 is configured to form a sample by bidirectionally formatting the document. For example, forming a document
  • the file used in the layout process (such as what characters, characters, and so on).
  • the large-scale construction unit 302 includes: a reverse-order character determining unit 3021, a reverse-sequence interval determining unit 3022, and a reverse-sequence position determining unit 3023.
  • the reverse character judging unit 3021 is for judging whether or not the character needs to be reversed from the thumbnail composed of the sample generating unit 301 in accordance with the default typesetting direction and the kind of the character. For example, the reverse character determining unit 3021 can judge the character character whose reading direction is opposite to the default typesetting direction as a character that needs to be reversed.
  • the reverse sequence determining unit 3022 is configured to determine, from the formed thumbnail, at least one reverse interval composed of consecutive characters requiring reverse ordering when constructing the large sample. Specifically, the reverse-sequence interval determining unit 3022 may first determine the row index of the character in the reverse order, and then determine the same, consecutive, reverse-ordered characters of all the row indexes as one reverse-sequence interval.
  • the reverse order position determining unit 3023 is for determining the position in the document to be reversed after the character is reversed, and recording the position in the large sample.
  • the reverse order position determining unit 3023 first determines the position of the character in the reverse sequence before the reverse order, and then exchanges the position of the nth character and the (k+1-n)th character in the reverse interval. Obtaining a position of the character after the reverse order, where k is the total number of characters in the reverse sequence, and n is an integer greater than or equal to 1 and less than or equal to k/2.
  • the reverse order position determining unit 3023 is configured to reverse the order of the characters in the reverse order section, and then determine the position of the reversed character in the reverse order section.
  • Method 400 begins with a constructional sample. Specifically, in step S401, the reverse character determining unit 3021 determines whether the character needs to be reversed. The purpose of this step is to determine which characters need to be reversed, thereby providing a basis for determining the reverse interval. Of course, this determination step is not necessary; for example, if you have directly attached information about which characters need to be reversed when you input the sample, or if you want to specify which characters need to be reversed when constructing a large sample, you do not need to perform this step. However, from the viewpoint of simple operation, it is preferable to perform the present judgment step (because this step can be automatically performed by a computer or the like, and no human operation is required).
  • the judgment may judge each character in a pair of documents, or may judge only a part of the selected paragraphs.
  • determining whether the character needs to be reversed may be performed according to a default layout direction of the document and a type of the character; more preferably, if the character is a text character whose reading direction is opposite to the default typesetting direction (such as Chinese characters, English letters, etc.) Need to reverse order.
  • the default layout direction is usually determined according to the custom layout direction of the content of the document body, so as to reduce the calculation amount of the reverse sequence step.
  • step S402 the reverse sequence section determining unit 3022 determines the row index of the character to be reversed (i.e., determines which line the character should be located in). That is to say, after determining the characters that need to be reversed, the reverse sequence interval determining unit 3022 first performs "pre-layout" on the document to determine which line the characters that need to be reversed should be in each line (of course, no reverse-order characters are required).
  • the row index can also be determined together) to determine which characters need to be reversed and should be in a reverse order, avoiding the characters in the two rows being reversed together and making an error.
  • the first line can only accommodate 5 Chinese characters, so the "Beijing Beidafang" 5 word line index is set to 01, and "positron”
  • the 3-word row index is set to 02.
  • the judgment step may not be performed.
  • step S403 the reverse-sequence interval determining unit 3022 determines the same, consecutive reverse-needed characters whose entire row index is the same as one reverse-sequence interval. That is to say, each reverse sequence should be a continuous, reverse-order character in the same line, with no line breaks, newlines, characters that do not need to be reversed, etc.; All consecutive characters that need to be reversed should be determined as a reverse interval, and will not be divided into several reverse intervals; If the characters in a row that need to be reversed are discontinuous parts (that is, characters with no reverse order, etc.), they should be divided into several reverse order intervals to ensure each reverse order The characters that need to be reversed are continuous.
  • the reverse order position determining unit 3023 calculates the position of the character in the reverse order after the reverse order.
  • the reverse order position determining unit 3023 may determine the position of the characters in the reverse order before the reverse order, that is, the position where the characters are first discharged in the default typesetting direction.
  • Beijing Beidafang is the first, second, third, fourth , the fifth character, their position index in the line (or X position, that is, the position where the layout is in the default layout direction) are 10, 11, 12, 13, 14, respectively, where each position index Represents a specific location in the row, and the corresponding character should be placed at that location after typesetting.
  • the position index is 10, the (k+1-n)th character (5th) is "square", the position index in the line is 14, and their positions are exchanged, so that the position index of "north” Change to 14, and the position index of the "square” becomes 10, and the two complete the reverse order; thus taking all the possible values of n (in this case, 1 and 2), then all the characters in the reverse sequence can be obtained. In the position after the reverse order.
  • Post-ordered position index 14 13 12 1 1 10 Table 1 the position of the character in the reverse-sequence interval: Similarly, the position of the "positron" 3 characters in the reverse direction of the second reverse sequence is calculated, and the typesetting result as shown in FIG. 3 is obtained.
  • the reverse order is performed when constructing a large sample
  • the characters stored in the sample are sequentially ordered characters, which are convenient for modification, etc.; at the same time, since each reverse sequence interval is continuous, the reverse order is required.
  • the character therefore, when it comes to format changes (such as folding, etc.), the reverse sequence will be divided into two, and the characters in each reverse interval are the characters corresponding to the position of the reverse interval ( For example, "Beijing Beifangfang" must be located in the first row, and "positron" must be in the second row).
  • the correct position of all characters will be obtained, and the existing position will not appear. Errors like the two-way typesetting method (for example, "Beijing North” is placed in the second line, and "positron,” enters the first line).
  • the reverse order position determining unit 3023 may further calculate the position of the characters in the reverse sequence by the following steps: 1) reverse the order of the characters in the reverse sequence; and 2 ) Determine the position of the reversed character in the reverse order. That is to say, in this step, the characters in the reverse order are reversed in order, and then the characters in the reverse order are typeset in the default typesetting direction, and the correct typesetting result can be obtained.
  • step S405 the reverse order position determining unit 3023 records the position (or index) after the character is reversed in the large sample; of course, other general information such as the position information of the character not reversed, the format information of the document, and the like may be Save together in the large sample.
  • Fig. 5 is a schematic diagram showing the result of the layout formed according to the method shown in Fig. 4.
  • the "character order" in the sample is not reversed, but the "character position" can be directly reversed when constructing the large sample as described above; therefore, one side
  • the meaning and order of the contents stored in the sample are correct, which facilitates data exchange and is easy to operate.
  • the exact position after the character is reversed can be directly determined, and no error is caused by the format change, etc. The result is accurate.
  • the disclosed and other embodiments, and the functional operations described in this specification can be implemented in the form of digital circuits or computer software, firmware or hardware including the structures disclosed in the specification and their structural equivalents, or one of them. Or a combination of multiples to implement.
  • the disclosed and other embodiments can be implemented as one or more computer program products, i.e., one or more modules of computer program instructions encoded on a computer readable medium for execution or control of operation by a data processing device.
  • the computer readable medium can be a machine readable storage device, a machine readable storage substrate, a memory device, a synthetic material that affects a machine readable communication signal, or a combination of one or more of them.
  • data processing apparatus encompasses all apparatus, devices, and machines for processing data, including, for example, a programmable processor, a computer, a plurality of processors, or a computer.
  • the apparatus can include code that creates an execution environment for the computer program in question, such as code that forms processor firmware, a protocol branch, a database management system, and an operating system, or one or more combinations thereof.
  • a propagated signal is an artificially generated signal, such as a machine-generated electrical, optical, or electromagnetic signal that is generated to encode information for transmission to an appropriate receiver device.
  • a computer program (also referred to as a program, software, software application, script, or code) can be written in any form of programming language, including compiled or interpreted language, and can be deployed in any form, including as a stand-alone program. Or as a module, component, subroutine or other unit suitable for use in a computing environment.
  • the computer program does not need to correspond to a file in the file system.
  • the program may be stored in a portion of a file that holds other programs or data (eg, one or more scripts stored in a markup language document), in a single file dedicated to the program in question, or multiple collaborative files (eg, A file of one or more modules, subroutines or code portions is stored.
  • the computer program can be deployed to be executed on one computer or on multiple computers located at one location or distributed across multiple locations and interconnected by a communication network.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Document Processing Apparatus (AREA)
  • Processing Or Creating Images (AREA)
  • Machine Translation (AREA)

Abstract

一种双向排版方法和设备。该方法包括:获取为文档进行双向排版而形成的小样;从所述获取的小样中确定出由连续的需要反序的字符组成的至少一个反序区间;以及确定需要反序的所述字符反序后在所述文档中将要所处的位置,并将所述位置记录在大样中。

Description

双向排版方法和设备
交叉引用
本申请要求 201 1年 12月 3 1 日提交的、 申请号为 201 1 10459186.3 的发明申请的优先权, 其全部内容通过引用并入本文。 技术领域
本发明属于排版技术领域, 具体涉及一种双向排版方法和设备。 背景技术
不同语言有不同的阅读方向, 比如中文、 英文、 拉丁文等通常从左 向右读(写), 而维文、 阿拉伯文、希伯来文等通常从右向左读 (写); 因此, 不同语言应使用不同的排版方向(即输入字符的顺序与排版后字符位置 间的关系), 以使在报纸、 书籍等中其显示顺序也不同。
显然, 在向小样输入字符时都是根据"意义"的顺序输入, 与排版方 向无关。 现有的双向排版方法是对小样中"字符的顺序"直接进行反序(即 颠倒字符的在小样中存储的前后顺序), 并用反序后的小样构造大样。 例 如, 在以维文为主体、 默认排版方向从右向左的文档中, 有"北京北大方 正电子 "的中文, 现有双向排版方法会将小样中的"北京北大方正电子" 反序成 "子电正方大北京北", 当用反序后的小样构造大样时, 按照从右 向左的默认排版方向即得如图 1所示的结果, 中文和维文都正确显示。
发明人发现现有技术中至少存在如下问题: 现有的双向排版方法直 接对小样中 "字符的顺序 "进行反序, 故小样存储的是反序后的意思混乱 的字符。 因此, 在进行数据交换 (修改小样)时会发生困难; 如上述 "北京 北大方正电子 "的例子, 若要将其修改为"北京市的北大方正电子", 本来 在小样中的"北京"后边插入"市的"即可, 但因小样存储的是"子电正方大 北京北", 不符合中文语言习惯, 故操作人员很难判断该将"市的"插入到 何处; 且"市的"如何反序也存在问题(因为此时其它中文内容已经反序 了, 而"市的"还未反序)。 同时, 构造大样时的格式变化 (如折行等)则容 易引起错误, 如上述 "北京北大方正电子 "的例子, 若大样中第一行剩余 空间只能容纳 5个汉字, 则现有双向排版方法会用反序后小样中顺序在 前的"子电正方大" 5个字在大样第一行按从右向左的排版方向生成"大方 正电子", 之后小样中剩余的内容再于大样第二行生成"北京北", 从而得 到如图 2所示的排版结果, 虽然其中每行中的中文顺序都正确(都是从左 向右的), 但整体的排版结果却为"大方正电子北京北" (即本该在第一行 中的部分字符进入了第二行, 而本该在第二行中的字符进入了第一行), 意义混乱。
其中, 字符、 小样、 大样均是本领域中的常用技术术语。 字符通常 指可输入电子设备的最小的文本单元, 包括文字字符 (如一个汉字、 一个 英文字母等)、 符号字符 (逗号、 句号等), 格式字符 (如折行符等)等类型; 小样通常指主要包括文档内容 (如具体是什么字符、 字符的前后顺序等) 的排版过程中用的文件; 而大样通常指由小样得到的、 包括排版位置信 息(比如某个字符位于什么位置等)的排版过程中用的文件, 其中字符的 位置可用行索引(即字符位于哪行)、 位置索引(即字符位于行中的什么位 置)等表示。 发明内容
本申请的一方面提供了一种双向排版方法。 该方法可包括: 获取为文档进行双向排版而形成的小样;
从所述获取的小样中确定出由连续的需要反序的字符组成的至少一 个反序区间; 以及
确定需要反序的所述字符反序后在所述文档中将要所处的位置, 并 将所述位置记录在大样中。
本申请的另一方面提供了一种双向排版设备。 该设备可包括用于构 造大样的大样构造单元, 其中, 所述大样构造单元包括:
反序区间确定单元, 用于在构造大样时, 从为文档进行双向排版而 形成的小样中确定由连续的需要反序的字符组成的至少一个反序区间; 以及
反序位置确定单元, 用于确定需要反序的所述字符反序后在所述文 档中将要所处的位置, 并将所述位置记录在大样中。
本申请的另一方面提供了这样一种计算机可读存储介质, 在该存储 介质中存储有:
用于获取为文档进行双向排版而形成的小样的指令;
用于从所述获取的小样中确定出由连续的需要反序的字符组成的至 少一个反序区间的指令; 以及
用于确定需要反序的所述字符反序后在所述文档中将要所处的位 置, 并将所述位置记录在大样中的指令。
本发明的双向排版方法中, 不是对小样中的 "字符顺序"进行反序, 而是在构造大样时直接将"字符位置"反序; 因此, 一方面其小样中存储 的内容意义和顺序均正确, 便于进行数据交换, 操作简单; 另一方面, 构造大样时可直接确定字符反序后的准确位置, 不会因为格式变化等引 发错误, 排版结果准确。
本发明特别适用于在同一段中含有阅读方向不同的文字的文档的排 版, 如同一段中同时含有中文和维文的文档、 同时含有英文和阿拉伯文 的文档等。 附图说明
图 1为现有的双向排版方法的正确的排版结果的示意图;
图 2为现有的双向排版方法折行时的错误的排版结的果示意图; 图 3为根据本申请一个实施方式的双向排版设备的方框图。
图 4为根据本申请一个实施方式的双向排版方法的流程意图; 以及 图 5为根据图 4所示的方法形成的排版结果的示意图。 具体实施方式
为使本领域技术人员更好地理解本发明的技术方案, 下面结合附图 和具体实施方式对本发明作进一步详细描述。
图 3 示出了根据本申请一个实施方式的双向排版设备 300。 如图 3 所示, 设备 300至少包括小样生成单元 301和大样构造单元 302。 小样 生成单元 301用于为文档进行双向排版而形成小样。 例如, 形成文档内 容 (如具体是什么字符、 字符的前后顺序等)的排版过程中用的文件。 大 样构造单元 302包括: 反序字符判断单元 3021、反序区间确定单元 3022 和反序位置确定单元 3023。
反序字符判断单元 3021用于根据默认排版方向以及字符的种类,从 小样生成单元 301构成的小样中判断字符是否需要反序。 例如, 反序字 符判断单元 3021 可将阅读方向与默认排版方向相反的文字字符判断为 需要反序的字符。
反序区间确定单元 3022用于在构造大样时,从形成的小样中确定由 连续的需要反序的字符组成的至少一个反序区间。 具体地, 反序区间确 定单元 3022可首先确定所需要反序的字符的行索引,然后将全部行索引 相同的、 连续的需要反序的字符确定为一个反序区间。
反序位置确定单元 3023 用于确定需要反序的所述字符反序后在所 述文档中将要所处的位置, 并将该位置记录在大样中。 在一个实施方式 中, 反序位置确定单元 3023 首先确定反序区间中的字符在反序前的位 置, 然后交换反序区间中第 n个字符与第(k+1-n)个字符的位置, 得到所 述字符在反序后的位置, 其中 k为所述反序区间中的字符总数, n为大 于等于 1且小于等于 k/2的整数。 可选地, 反序位置确定单元 3023被配 置为对反序区间中的字符的顺序进行反序, 然后确定反序后的字符在反 序区间中的位置。
下面将参照图 4所示的方法 400进一步对上述各单元之间的协作进 行描述。
方法 400从构造大样开始。 具体地, 在步骤 S401中, 反序字符判断 单元 3021判断字符是否需要反序。本步骤的目的在于确定哪些字符需要 反序, 从而为反序区间的确定提供依据。 当然, 本判断步骤也不是必须 的; 例如, 如果在输入小样时已经直接附带了哪些字符需要反序的信息, 或者在构造大样时人为规定哪些字符需要反序, 就可不必进行本步骤。 但从操作简单的角度出发,优选进行本判断步骤(因为本步骤可通过计算 机等自动进行, 不必人为操作)。 该判断可为逐一对文档中的每个字符进 行判断, 也可为只对部分选定的段落进行判断。 优选的, 判断字符是否需要反序可根据文档默认的排版方向以及字 符的种类进行; 更优选的, 若字符为阅读方向与默认排版方向相反的文 字字符 (如汉字、 英文字母等)则判断字符需要反序。 其中, 默认排版方 向通常根据文档主体内容的习惯排版方向确定, 以减少反序步骤的运算 量。 如上述 "北京北大方正电子 "的例子, 文档以维文为主, 故默认排版 方向从右向左, 而中文通常的阅读方向为从左向右, 即"北京北大方正电 子"为阅读方向与默认排版方向相反的文字字符,故可判断其全为需要反 序的字符, 而维文则不需要反序。 因为字符是否需要反序主要由语言种 类决定, 故这种判断方法可有效减少判断所需的运算量。 当然, 具体的 判断方法也可进行许多变化, 例如判断时还可考虑是否有特殊的格式要 求 (如是否有某段中文被特别规定为从右向左排版), 或者对于符号字符 (逗号、 句号、 空格等)釆用的是何种判定方法 (现有的对符号字符排版方 向的判断有按前序字符判断、 按后序字符判断、 单独判断等多种方法, 其具体方法是已知的, 在此就不再详细叙述了)。
在步骤 S402 , 反序区间确定单元 3022确定需要反序的字符的行索 引(即确定字符应位于哪行中)。 也就是说, 反序区间确定单元 3022在确 定出需要反序的字符后, 先对文档进行 "预排版", 以确定需要反序的字 符分别应当处于哪行中(当然不需要反序的字符的行索引也可一起确 定), 以便确定哪些需要反序的字符是连续而应位于一个反序区间中的, 避免将分别位于两行中的字符一起反序而弓 1发错误。例如上述"北京北大 方正电子"的例子, 其"预排版 "后确定第一行只能容纳 5个汉字, 故"北 京北大方" 5个字的行索引被定为 01 , 而"正电子 "3个字的行索引被定为 02。 当然, 如果在小样中已经用折行符等对全部格式做了规定, 则本判 断步骤也可不进行。
在步骤 S403 , 反序区间确定单元 3022将全部行索引相同的、 连续 的需要反序的字符确定为一个反序区间。 也就是说, 每个反序区间中应 该是处于同一行中的、 连续的、 需要反序的字符, 其间没有折行符、 换 行符、 不需反序的字符等; 同时, 处于一行中的所有连续的需要反序的 字符应被确定为一个反序区间, 而不会被分成几个反序区间; 当然, 如 果一行中的需要反序的字符是不连续的几个部分(即其间夹杂有不需反 序的字符等), 则它们应被分为几个反序区间, 以保证每个反序区间中的 需要反序的字符都是连续的。 其中, 由于单个的需要反序的字符 (例如一 段维文中突然出现一个汉字)不可能是"连续"的, 也就不必被确定为反序 区间。在上述 "北京北大方正电子 "的例子中, "北京北大方 "5个需要反序 的字符连续 (之间没有维文等)且处于一行中(行索引均为 01) , 故被确定 为第一个反序区间, 而 "正电子"被确定为第二个反序区间。
在步骤 S404, 反序位置确定单元 3023计算反序区间中的字符反序 后的位置。 例如,反序位置确定单元 3023可确定反序区间中的字符在反 序前的位置, 即按默认排版方向先排出各字符所在的位置。 在上述 "北京 北大方正电子 "的例子中, 如下表 1所示, 在第一个反序区间中, 按默认 排版方向, "北京北大方 "分别为第 1、 第 2、 第 3、 第 4、 第 5个字符, 它们在该行中的位置索引(或称 X位置,也就是按默认排版方向排版后所 处的位置)分别为 10、 11、 12、 13、 14, 其中每个位置索引代表该行中 的一个特定位置, 对应的字符排版后应位于该位置处。
交换反序区间中第 n个字符与第(k+1-n)个字符的位置, 得到两字符 在反序后的位置, 其中 k为反序区间中的字符总数, n为大于等于 1且 小于等于 k/2 的整数。 上述"北京北大方正电子"的例子中, 第一个反序 区间中 k=5 , 则当 n=l时, 反序前第 n个 (第 1个)字符为 "北", 在该行中 的位置索引为 10, 第(k+1-n)个字符 (第 5个)为"方", 在该行中的位置索 引为 14, 对它们的位置进行交换, 从而"北"的位置索引变为 14, 而"方" 的位置索引变为 10, 二者完成反序; 这样依次取 n的全部可能值 (本例 中为 1和 2) , 即可得到该反序区间中的全部字符在反序后的位置。
字符 北 京 北 大 方 字符的序号 (n) 1 2 3 4 5 反序前的位置索引 10 1 1 12 13 14 与其交换位置的字符的序号 5 4 3 2 1 ( n+k- 1 )
反序后的位置索引 14 13 12 1 1 10 表 1、 交换反序区间中字符位置的 :禾呈不意表 与此类似, 再计算第二个反序区间中"正电子 "3 个字符反序后的位 置, 即可得到如图 3所示的排版结果。
在本实施例中, 由于反序是在构造大样时进行的, 故小样中存储的 是顺序正确的字符, 便于进行修改等; 同时, 由于每个反序区间中都是 连续的需要反序的字符, 因此, 当涉及到格式变化 (如折行等)时, 反序 区间会被分为两个, 每个反序区间中的字符都是该反序区间的位置所应 对应的字符 (例如 "北京北大方 "必然位于第一行, 而"正电子 "必然位于第 二行), 这样在对各反序区间进行反序后, 必然能得到全部字符的正确位 置, 不会出现现有双向排版方法那样的错误 (例如 "北京北"被排入第二 行, 而"正电子,,进入第一行)。
可选地, 在步骤 S404中, 反序位置确定单元 3023还可以通过以下 步骤计算反序区间中的字符反序后的位置: 1 )对反序区间中的字符的顺 序进行反序; 以及 2) 确定反序后的字符在反序区间中的位置。 也就是 说, 在该步骤中, 先将反序区间中字符的前后顺序进行颠倒, 再按默认 排版方向对前后顺序颠倒的字符进行排版, 同样可以得到正确的排版结 果。 在上述 "北京北大方正电子 "的例子中, 先将第一个反序区间中的"北 京北大方" 5 个字符的顺序直接反序为"方大北京北", 之后将 "方大北京 北" 5 个字符按照默认排版方向(从右向左)直接排版, 则排版后各字符的 位置就是反序区间中的字符反序后的位置; 同理, 对第二个反序区间中 的"正电子 "3个字符也按相同方法排版, 同样可得到如图 5所示的排版 结果。 这种方法在确定字符位置前对字符的顺序进行反序, 而不是在排 好位置后再交换位置, 用不同的方法实现了本发明的目的。
在步骤 S405 , 反序位置确定单元 3023将字符反序后的位置 (或称索 引)记录在大样中; 当然, 未反序的字符的位置信息、 文档的格式信息等 其它的常规信息也可一同保存在大样中。 图 5所示即为根据图 4所示的 方法形成的排版结果的示意图。
根据本申请上述的方法和设备不是对小样中的"字符顺序"进行反 序, 而可按上述方法在构造大样时直接将"字符位置"反序; 因此, 一方 面其小样中存储的内容意义和顺序均正确, 便于进行数据交换, 操作简 单; 另一方面, 构造大样时可直接确定字符反序后的准确位置, 不会因 为格式变化等引发错误, 排版结果准确。
所公开的和其它实施例以及该说明书中所描述的功能性操作能够以 数字电路或者包括该说明书中所公开的结构及其结构等同物的计算机软 件、 固件或硬件来实施, 或者以它们的一个或多个的组合来实施。 所公 开的和其它实施例可作为一个或多个计算机程序产品来实施, 即在计算 机可读介质上进行编码的计算机程序指令的一个或多个模块, 以便由数 据处理装置来执行或者控制其操作。 所述计算机可读介质可以是机器可 读的存储设备、 机器可读的存储基片、 存储器设备、 影响机器可读的传 播信号的合成物质或它们的一个或多个的组合。 术语"数据处理装置 "包 含用于处理数据的所有装置、 设备和机器, 例如包括可编程处理器、 计 算机、 多个处理器或计算机。 除了硬件之外, 所述装置可包括创建所讨 论的计算机程序的执行环境的代码, 例如构成处理器固件、 协议枝、 数 据库管理系统和操作系统或它们的一个或多个组合的代码。 传播信号是 人工生成的信号, 例如机器生成的电、 光或电磁信号, 其被生成来对信 息进行编码以便传送到适当的接收器装置。
计算机程序(还被称为为程序、 软件、 软件应用、 脚本或代码)可以 以任意形式的编程语言来书写, 包括编译的或解释性语言, 并且其可以 以任意形式被部署, 包括作为独立程序或作为模块、 组件、 子程序或适 于在计算环境中使用的其它单元。 计算机程序无需对应于文件系统中的 文件。 程序可存储在保存其它程序或数据 (例如, 存储在标记语言文档中 的一个或多个脚本〉 的文件的一部分中、 专用于所讨论的程序的单个文 件中、 或者多个协同文件 (例如, 存储一个或多个模块、 子程序或代码部 分的文件)中。计算机程序可被部署为在一个计算机或位于一个地点或分 布在多个地点并且通过通信网络互连的多个计算机上执行。
可以理解的是, 以上实施方式仅仅是为了说明本发明的原理而釆用 的示例性实施方式, 然而本发明并不局限于此。 对于本领域内的普通技 术人员而言, 在不脱离本发明的精神和实质的情况下, 可以做出各种变 型和改进, 这些变型和改进也视为本发明的保护范围

Claims

权 利 要 求 书
1. 一种双向排版方法, 包括:
获取为文档进行双向排版而形成的小样;
从所述获取的小样中确定出由连续的需要反序的字符组成的至少一 个反序区间; 以及
确定需要反序的所述字符反序后在所述文档中将要所处的位置, 并 将所述位置记录在大样中。
2. 根据权利要求 1所述的双向排版方法, 还包括:
根据默认排版方向以及字符的种类, 从所述生成的小样中判断所述 字符是否需要反序。
3. 根据权利要求 1所述的双向排版方法, 其中, 所述判断的步骤包 括:
判断所述字符是否为阅读方向与默认排版方向相反的文字字符, 若 是则所述字符需要反序。
4. 根据权利要求 1所述的双向排版方法, 其中, 所述确定由连续的 需要反序的字符组成的至少一个反序区间的步骤包括:
从所述生成的小样中确定出需要反序的字符的行索引; 以及 将全部行索引相同的、连续的需要反序的字符确定为一个反序区间。
5. 根据权利要求 1至 4中任意一项所述的双向排版方法, 其中, 确 定需要反序的所述字符反序后在所述文档中将要所处的位置的步骤包 括:
确定所述反序区间中的字符在反序前的位置; 以及
交换所述反序区间中第 n个字符与第(k+1-n)个字符的位置, 得到所 述字符在反序后的位置, 其中 k为所述反序区间中的字符总数, n为大 于等于 1且小于等于 k/2的整数。
6. 根据权利要求 1至 4中任意一项所述的双向排版方法, 其特征在 于, 确定需要反序的所述字符反序后在所述文档中将要所的位置包括: 对所述反序区间中的字符的顺序进行反序; 以及
7. 一种双向排版设备, 包括用于构造大样的大样构造单元, 其中, 所述大样构造单元包括:
反序区间确定单元, 用于在构造大样时, 从为文档进行双向排版而 形成的小样中确定由连续的需要反序的字符组成的至少一个反序区间; 以及
反序位置确定单元, 用于确定需要反序的所述字符反序后在所述文 档中将要所处的位置, 并将所述位置记录在大样中。
8. 根据权利要求 7所述的双向排版设备, 还包括:
反序字符判断单元, 用于根据默认排版方向以及字符的种类, 从所 述生成的小样中判断所述字符是否需要反序。
9、 根据权利要求 7所述的双向排版设备, 还包括:
反序字符判断单元, 用于将阅读方向与默认排版方向相反的文字字 符判断为需要反序的字符。
10、 根据权利要求 7所述的双向排版设备, 其中, 所述反序区间确 定单元还被配置为确定所述需要反序的字符的行索引, 并将全部行索引 相同的、 连续的需要反序的字符确定为一个反序区间。
1 1、 根据权利要求 7所述的双向排版设备, 其中, 所述反序位置确 定单元被配置为:
确定所述反序区间中的字符在反序前的位置; 以及
交换所述反序区间中第 n个字符与第(k+1-n)个字符的位置, 得到所 述字符在反序后的位置, 其中 k为所述反序区间中的字符总数, n为大 于等于 1且小于等于 k/2的整数。
12、 根据权利要求 7所述的双向排版设备, 其中, 所述反序位置确 定单元被配置为:
对所述反序区间中的字符的顺序进行反序; 以及
PCT/CN2012/088012 2011-12-31 2012-12-31 双向排版方法和设备 WO2013097805A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US14/130,237 US9613005B2 (en) 2011-12-31 2012-12-31 Method and apparatus for bidirectional typesetting

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201110459186.3 2011-12-31
CN201110459186.3A CN103186519B (zh) 2011-12-31 2011-12-31 双向排版方法和设备

Publications (1)

Publication Number Publication Date
WO2013097805A1 true WO2013097805A1 (zh) 2013-07-04

Family

ID=48677690

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/088012 WO2013097805A1 (zh) 2011-12-31 2012-12-31 双向排版方法和设备

Country Status (3)

Country Link
US (1) US9613005B2 (zh)
CN (1) CN103186519B (zh)
WO (1) WO2013097805A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104462034A (zh) * 2013-09-17 2015-03-25 北大方正集团有限公司 双向排版中空格的处理方法及系统

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103186519B (zh) * 2011-12-31 2017-04-05 北大方正集团有限公司 双向排版方法和设备
CN104750671B (zh) * 2013-12-25 2019-01-11 北大方正集团有限公司 一种基于大样反序的双向排版字符插入方法及装置
CN105573974B (zh) * 2014-10-09 2018-07-03 北大方正集团有限公司 版面的编排方法、装置及系统
CN107284039B (zh) * 2016-04-01 2023-12-26 常州金品精密技术有限公司 多通道在线自动打标装置及打标方法
CN108920433B (zh) * 2018-07-17 2022-02-25 海信视像科技股份有限公司 一种文本显示方法、系统及终端
CN111881656B (zh) * 2020-08-11 2024-02-23 网易(杭州)网络有限公司 一种卡牌游戏中的文本绘制方法及装置

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101295290A (zh) * 2008-06-11 2008-10-29 北大方正集团有限公司 一种多行文字行中排版的方法
CN101916246A (zh) * 2010-07-30 2010-12-15 汉王科技股份有限公司 电子文档排版方法及装置
CN102110108A (zh) * 2009-12-28 2011-06-29 北大方正集团有限公司 一种对小样文件的处理方法及装置

Family Cites Families (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE69526411T2 (de) * 1994-12-07 2002-08-08 King Jim Co Ltd Zeichenprozessor zum Drucken von Zeichen
US6763376B1 (en) * 1997-09-26 2004-07-13 Mci Communications Corporation Integrated customer interface system for communications network management
US6496830B1 (en) * 1999-06-11 2002-12-17 Oracle Corp. Implementing descending indexes with a descend function
US6647533B1 (en) * 1999-10-25 2003-11-11 Xerox Corporation Incremental algorithms for optimal linebreaking in text layout
US6944820B2 (en) * 2001-03-27 2005-09-13 Microsoft Corporation Ensuring proper rendering order of bidirectionally rendered text
US7120900B2 (en) * 2001-04-19 2006-10-10 International Business Machines Bi-directional display
NO316480B1 (no) * 2001-11-15 2004-01-26 Forinnova As Fremgangsmåte og system for tekstuell granskning og oppdagelse
US20070139661A1 (en) * 2004-08-05 2007-06-21 Quark, Inc. Systems and methods for producing media products
US20070079236A1 (en) * 2005-10-04 2007-04-05 Microsoft Corporation Multi-form design with harmonic composition for dynamically aggregated documents
EP3107002A1 (en) * 2006-01-24 2016-12-21 ZIH Corp. Global printing system and method of using same
CN1821994B (zh) * 2006-03-31 2010-05-26 北京北大方正电子有限公司 一种根据版心背景格对文字块进行自动分栏的方法
CN100435142C (zh) * 2006-10-13 2008-11-19 北京北大方正电子有限公司 一种不同排版顺序的文种混合排版的方法
US7975217B2 (en) * 2007-12-21 2011-07-05 Google Inc. Embedding metadata with displayable content and applications thereof
US8819541B2 (en) * 2009-02-13 2014-08-26 Language Technologies, Inc. System and method for converting the digital typesetting documents used in publishing to a device-specfic format for electronic publishing
CN102023965B (zh) 2009-09-17 2013-12-18 康佳集团股份有限公司 一种适用于显示设备的双向文本布局的方法和系统
CN103186519B (zh) * 2011-12-31 2017-04-05 北大方正集团有限公司 双向排版方法和设备

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101295290A (zh) * 2008-06-11 2008-10-29 北大方正集团有限公司 一种多行文字行中排版的方法
CN102110108A (zh) * 2009-12-28 2011-06-29 北大方正集团有限公司 一种对小样文件的处理方法及装置
CN101916246A (zh) * 2010-07-30 2010-12-15 汉王科技股份有限公司 电子文档排版方法及装置

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104462034A (zh) * 2013-09-17 2015-03-25 北大方正集团有限公司 双向排版中空格的处理方法及系统

Also Published As

Publication number Publication date
US20150019959A1 (en) 2015-01-15
CN103186519A (zh) 2013-07-03
CN103186519B (zh) 2017-04-05
US9613005B2 (en) 2017-04-04

Similar Documents

Publication Publication Date Title
WO2013097805A1 (zh) 双向排版方法和设备
US20140331125A1 (en) Methods, systems, and media for guiding user reading on a screen
CN1716264B (zh) 利用控制程序信息注释并呈现系统踪迹的方法和系统
US8443335B2 (en) Apparatus and method for circuit design
US10049095B2 (en) In-context editing of output presentations via automatic pattern detection
WO2016138510A1 (en) Contextual zoom
US20100107048A1 (en) Document processor and document processing method
CN1525357A (zh) 用于显示数据格式化文档中未标注文本节点的方法和系统
CN102830947A (zh) 一种基于报表打印模板格式实现的报表打印控件
Bewig How do you know your spreadsheet is right?
CN111916163B (zh) 用于临床研究中药物试验的现场管理系统实现方法和装置
JP2014199569A (ja) ソースプログラム解析システム、ソースプログラム解析方法およびプログラム
KR102110281B1 (ko) 자동화된 작성물 평가기
MXPA06013949A (es) Interfase de diseño auxiliada por computadora.
KR101797573B1 (ko) 웹 기반의 스프레드시트 서비스 제공 장치 및 방법
JPWO2006046665A1 (ja) 文書処理装置及び文書処理方法
US5771392A (en) Encoding method to enable vectors and matrices to be elements of vectors and matrices
WO2006001392A1 (ja) 文書処理方法および装置
US20130124928A1 (en) Method and apparatus for the display of multiple errors on a human-machine interface
CN115577683B (zh) 一种html富文本内容转换方法、装置、设备和介质
Lardilleux et al. Allongos: Longitudinal alignment for the genetic study of writers’ drafts
JP4417384B2 (ja) 文書処理装置および文書処理方法
Kyrnin Sams Teach Yourself HTML5 Mobile Application Development in 24 Hours
WO2016129765A1 (ko) 웹페이지 구축 장치 및 방법
JP2007501464A (ja) Xml文書の確率に基づく検証のための方法およびシステム

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 12863061

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 14130237

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 12863061

Country of ref document: EP

Kind code of ref document: A1