4 52 7 0 ? 五、發明說明(1) 【發明的應用範圍】 本發明係有關於一種字串換行的方法,用以在文字顯 示裝置中,對不等寬的字元(character)所組成的字串 (S t r i ng)執行換行的動作、 【發明背景】 在一般的視窗作業系統(如Windows 95或Windows 98 )中,所提供的字體大致上可以分為兩類: 1 ·等寬的字體:係指字串中的每個字元的寬度皆相 同,如中文字元、Courier以及Courier New等幾 種字體,等寬字體的種類有限,字型的變化上也 比較簡單。 2 ·不等寬的字體:係指字串中的每個字元的寬度皆 不相等,如羅馬字體、TrueType字體等,不等寬 字體的種類較豐富,字型的顯示效果也比較美 觀。 在文書編輯的時候,如果遇到一般的等寬的字元,對 電腦的處理而言,常常是以等間距的字體表現,在換行的 運算上比較簡單,只要將行寬除以字元的寬度,就可以計 算每行可以容納的字數,之後只要累加每行的輸入字數, 就可以判斷是否需要換行。 但是對於所謂的西文,即文字是以字母組合成以單字 為單位的型態的文字,為求電腦上所表現出的態樣能符合 平時書寫的習慣,以及電腦上的字型能有豐富的變化和效 果,多半便有採用非等間距的字體。4 52 7 0? V. Description of the invention (1) [Scope of application of the invention] The present invention relates to a method of string wrapping, which is used in a text display device to consist of characters of unequal width (character). The string (S tri ng) performs a line-wrapping action. [Background of the Invention] In a general Windows operating system (such as Windows 95 or Windows 98), the fonts provided can be roughly divided into two categories: 1 Font: refers to the same width of each character in the string, such as Chinese characters, Courier and Courier New. Several types of monospace fonts are limited, and the change of fonts is relatively simple. 2 · Unequal-width font: refers to the unequal width of each character in the string, such as Roman fonts, TrueType fonts, etc. There are many types of unequal-width fonts, and the display effect of the fonts is more beautiful. When editing a document, if you encounter ordinary characters of the same width, for computer processing, they are often expressed in equal-spaced fonts. It is relatively simple to calculate line breaks, as long as you divide the line width by the Width, you can calculate the number of words that can be accommodated in each line, and then you can determine whether a line break is needed as long as the number of input words in each line is accumulated. However, for the so-called Western language, that is, the words are composed of letters to form a single-word type of text, in order to find that the appearance of the computer can meet the usual writing habits, and the font on the computer can be rich Most of the changes and effects are non-equidistant fonts.
五、發明說明(2) 而在一個固定的行寬中,每行可編輯的不等寬字元是 一個不定數,要確定每行的字元數,就要個別取得各字元 的寬度和行寬相比,因此要實現不等寬字元所組成的字串 的換行,其演算法的效率就非常的重要。 一般的解決方法是,在已知此行首字元的情況下逐個 向後累加各字元寬度,並與行寬比較,以確定此字元是在 本行還是下一行,如果累加各字元寬度大於行寬,在根據 WORD WRAP規則把恰當的單詞折換到下一行。如果此行實 際能編輯的字元數是N,則累加寬度與行寬的比較次數便 為N,因此要花不短的時間比較字元累加寬度與行寬,使 得換行的運算顯得較沒有效率。 【發明之目的與概述】 如上所述,本發明的主要目的在於〖提供一種可以提高 字串的換行效率的方法,用以在文字顯示裝置中,對不等 寬的字元所組成的字_執行換行的動作,係藉由能編輯的 最寬字元的數目加快確定實際能編輯的字元數目,在已知 一行所能編輯的實際字元數後,由行尾向行首搜索本行字 元,將恰到的單詞折到下一行。根據本發明所揭露的方 法,主要包括有下列步驟: 將該字串的首字元設定為讀取的初始字元; 將該行之全部行寬設定為可用行寬值; 取得該字串中之最寬字元的字寬值; 根據該字寬值計算該行可容鈉之最多最寬字元Ν ; 自該字串之首字元起開始逐一讀取Ν+ 1個字元,並V. Description of the Invention (2) In a fixed line width, the unequal-width characters that can be edited in each line are an indefinite number. To determine the number of characters in each line, the width and width of each character must be obtained individually. Compared with the line width, the efficiency of the algorithm is very important to realize the line break of the string composed of unequal characters. The general solution is to accumulate the character widths one by one when the first character of the line is known, and compare it with the line width to determine whether the character is in this line or the next line. If the character widths are accumulated Greater than the line width, according to the WORD WRAP rules, the appropriate word is converted to the next line. If the number of characters that can actually be edited on this line is N, the number of comparisons between the accumulated width and the line width is N, so it takes a short time to compare the accumulated width of the characters with the line width, making the operation of line wrapping seem inefficient. . [Objective and Summary of the Invention] As mentioned above, the main object of the present invention is to provide a method that can improve the line-wrapping efficiency of a character string in a text display device. Performing a line feed action is to speed up the determination of the actual number of characters that can be edited by the number of the widest characters that can be edited. After the actual number of characters that can be edited in a line is known, the end of the line is searched for the beginning Character, folds the right word to the next line. The method disclosed in the present invention mainly includes the following steps: setting the first character of the string as the initial character to be read; setting the entire line width of the line to an available line width value; obtaining the character string The width of the widest character; calculate the maximum width of the widest character N that can be accommodated in the line based on the value of the character; read N + 1 characters one by one from the first character of the string, and
第5頁 ^52 70 ? 五、發明說明(3) 計算N + 1個字元的累加寬度;以及 比較該累加寬度與該行行寬,如果該累加寬度小於該 行寬,則將第N + 2個字元設為讀取的初始字元,並將剩 餘行寬設為該行之可用行寬值,返回計算最多字元的步 驟,如果該累加寬度大於行寬,則自該字串中決定下一行 的首字元,並將該首字元換到下一行。 本方法減少了編輯框令字元換行時累加字元寬度與行 寬的比較次數,節省時間,達到提高字元換行效率的目 的。 有關本發明之詳細内容及技術,茲就配合圖式說明如 下: 【圖式簡單說明】 第1圖,為本發明所揭露的方法流程圖。 第2 A-2 I圖,為本發明所揭露的方法之各步驟實施 例示意圖。 【發明之詳細說明】 根據本發明所揭露的方法,係從字串中找一最寬字 元,再以此行的行寬除此最寬字元的字寬計算出此行所能 編輯的最寬字元的字元數N,從此行的首字元開始向後讀 取N +1個字元(同時判斷有無分行字元以及結束字元), 計算N十1個字元的字元寬度,並用行寬減去此N +1個字元的 寬度值,以得到此行還可編輯的最寬字元數,接著再自 N + 2個字元重複以上的操作流程,一直到實際的寬度已經 超過了行寬,便自此單.詞向前讀取單詞分隔字元,如果搜Page 5 ^ 52 70? 5. Explanation of the invention (3) Calculate the accumulated width of N + 1 characters; and compare the accumulated width with the line width. If the accumulated width is less than the line width, the N + The 2 characters are set as the initial characters to be read, and the remaining line width is set to the available line width value of the line. The step of calculating the maximum number of characters is returned. If the accumulated width is greater than the line width, it is removed from the string. Decide on the first character of the next line and replace it with the next character. This method reduces the number of comparisons between the accumulated character width and line width when the character is wrapped in the edit box, saves time, and achieves the purpose of improving the efficiency of character wrapping. The detailed content and technology of the present invention are described below with reference to the drawings: [Brief description of the drawings] FIG. 1 is a flowchart of a method disclosed in the present invention. Figures 2A-2I are schematic diagrams of embodiments of the steps of the method disclosed in the present invention. [Detailed description of the invention] According to the method disclosed in the present invention, a widest character is found from a character string, and the width of the widest character is divided by the line width of the line to calculate the editable value of the line. The widest number of characters N, starting from the first character of this line and reading backward N + 1 characters (while determining whether there are line break characters and ending characters), calculate the character width of N eleven characters , And subtract the N +1 character width value from the line width to get the widest number of characters that can be edited in this line, and then repeat the above process from N + 2 characters until the actual If the width has exceeded the line width, it will be single since then.
第6頁 4 52 70 7Page 6 4 52 70 7
五、發明說明(4) 尋到單詞分隔字元,將此單詞分隔字元後的字元作為下一 行的首字元。5. Description of the invention (4) Find the word delimiter, and use the character after the word delimiter as the first character of the next line.
接著,說明本發明的計算次數的確比習知的技術來得 少。假定最寬字元寬度為Lw,字元平均寬度為Lp,各字元 分佈盡量均勻,可得比較字元累加寬度與行寬次數近似 為:(1 ogdN) + 1,其中,N為此行實際能編輯的字符數, d = L w / L p ;而逐個向後累加各字符寬度與行寬比較以確定 此字符在本行還是再下一行的方法中,累加寬度與行寬的 比較次數為N,因為N > ( 1 ogdN) + 1,所以本發明所揭露 的方法,比較的次數較習知方法為少,比較有效率。 接著,配合「第1圖」,對上述的執行過程進行詳細 的流程描述,其步驟包括有: 步驟1 0 :開始; 步驟1 1 :設定操作的初始狀態(將本行的首字元作為 本次操作的初始字元,並將全部_行寬設為可用的行寬值, 搜尋字元係從相始字元開始); 步驟12:取得當前字串中最寬字元的寬度; 步驟13:計算本行還能編輯的最寬字元數N(用行寬 除以字串中最寬字元的寬度值); 步驟1 4 :從本次的操作初始字元開始讀取1個字元; 步驟1 5 :判斷是否讀到分行字元,若讀到分行字元, 則進行步驟2 2,否則進行步驟1 6 ; 步驟1 6 :判斷是否讀到結束字元,若讀到結束字元, 則進行步驟2 6,若未讀到結束字元,則繼續下一步驟;Next, it will be explained that the number of calculations of the present invention is indeed less than that of the conventional technique. Assume that the widest character width is Lw, the average character width is Lp, and the distribution of each character is as uniform as possible. It can be compared that the cumulative width of characters and the number of line widths are approximately: (1 ogdN) + 1, where N is the line The actual number of characters that can be edited, d = L w / L p; and the method of accumulating the width of each character and comparing the line width one by one to determine whether this character is in this line or the next line, the number of comparisons of the accumulated width and line width is N, because N > (1 ogdN) + 1, the method disclosed in the present invention has fewer comparisons than conventional methods and is more efficient. Next, in conjunction with "Figure 1", the above-mentioned execution process is described in detail. The steps include: Step 10: Start; Step 11: Set the initial state of the operation (take the first character of this bank as the original The initial character of this operation, and set all _line widths to the available line width values, and the search characters start from the phase start character); Step 12: Get the width of the widest character in the current string; Step 13 : Calculate the widest number of characters N that can be edited in this line (divide the line width by the width of the widest character in the string); Step 1 4: Read 1 character from the initial character of this operation Step 1 5: Determine whether a branch character is read. If a branch character is read, go to step 2 2; otherwise, proceed to step 16; Step 16: determine whether the end character is read. Yuan, proceed to step 26, if no end character is read, continue to the next step;
第7頁 ^5270 7 五、發明說明(5) 步驟1 7 :判斷是否讀取N + 1個字元,若是,則進行步 驟1 9,否則進行步驟1 8 ; 步驟1 8 :讀取下一個字元,接著進行步驟1 5 ; 步驟1 9 :計算所搜尋字元的累加寬度,進行下一步 驟; 步驟2 0 :將累加寬度與行寬進行比較,若小於等於, 則進行步驟1 3,重新計算本行還能編輯的最寬字元數N, 若大於,則進行步驟2 1 ; 步驟2 1 :從此位置向前,直到本行首字元,搜尋一個 單詞分隔字元; 步驟22:將此字元的下下個字元,作為下一行的首字 元; 步驟2 3 :判斷是否有單詞分隔字元,若有,則進行步 驟2 4,否則進行步驟2 5 ; ! 步驟2 4 :將此分隔字元的下一個字元,作為下一行的 首字元,然後進行步驟2 6 ; 步驟2 5 :將讀取到的最後一個字元作為下一行的首字 元然後進行步驟2 6 ; 步驟2 6 :換行; 步驟2 7 :結束。 【實施例】 接著,以一實施例並配合「第2 A— 2 I圖」做說明。 在編輯框中的緩衝區内容為” This is a sample for word wrap, please study it.",在本編輯字庫中的最寬字元Page 7 ^ 5270 7 V. Description of the invention (5) Step 17: Determine whether to read N + 1 characters, if yes, proceed to step 19, otherwise proceed to step 1 8; step 18: read next Character, then proceed to step 15; step 19: calculate the accumulated width of the searched character and proceed to the next step; step 20: compare the accumulated width with the line width, and if it is less than or equal to, proceed to step 1 3, Recalculate the widest number of characters N that can be edited in this line. If it is greater, go to step 2 1; Step 2 1: From this position forward to the first character of the line, search for a word separator; Step 22: Use the next character of this character as the first character of the next line; Step 2 3: Determine whether there is a word separator character, if it is, go to Step 2 4; otherwise, go to Step 2 5;! Step 2 4 : Use the next character of this delimiter as the first character of the next line, and then proceed to step 2 6; Step 2 5: Use the last character read as the first character of the next line, and then proceed to step 2 6; Step 26: Line feed; Step 27: End. [Example] Next, an example will be described in conjunction with the "2A-2I diagram". The content of the buffer in the edit box is "This is a sample for word wrap, please study it.", The widest character in this edit font
第8頁 4 52 7 0 7 五、發明說明(6) 為w,寬度為10,編輯框的寬度為193,換行的動作係透過 以下的步驟,步驟1至步驟6係由能編輯的最寬字符數加 快確定實際能編輯的字符數目,步驟7則為在已知一行所 能編輯的實際字元數目後,由後向前搜尋本行字元,將恰 當的單詞換到下一行,詳細的過程為: 開始:編輯框寬度為1 9 3,可編輯1 9個寬度為1 0的字 元w(w為本編輯中的最寬字元),如/第2A圖」; 步驟1 :從首字元開始向行尾搜索2 0個字元(到’ r ’ ),剩下的寬度為1 〇 1,還可編輯1 0個最寬字元,如「第 2 B圖」; 步驟2 :從第2 1個字元開始向行尾搜索1 1個字元(到 ’ ),剩下的寬度為3 6,還可編輯3個最寬字元,如「第 2 C圖」; 步驟3 :從第3 2個字元開始向行尾搜索4個字元(到 ’ e ’),剩下的寬度為2 2,還可編輯2個最寬字元,如「第 2 D圖」; 步驟4 :從第3 6個字元開始向行尾搜索3個字元(到 ’ eT ),剩下的寬度為4,還可編輯0個最寬字元,如「第 2 E圖」; 步驟5 :從第3 9個字元開始向行尾搜索1個字元(到 ’,空白字元),剩下的寬度為1,還可編輯0個最寬字 元,如「第2 F圖」; 步驟6 :從第4 0個字元開始向行尾搜索1個字元(到 ’s’),累加字元寬度以超出行寬,下一部找出下一行之Page 8 4 52 7 0 7 V. Description of the invention (6) is w, width is 10, edit box width is 193, the action of line feed is through the following steps, steps 1 to 6 are the widest editable Accelerate the number of characters to determine the actual number of characters that can be edited. Step 7 is to search for characters in this line from the back to the right after knowing the actual number of characters that can be edited in a line. The process is: Start: edit box width is 193, can edit 19 characters w with width of 10 (w is the widest character in the edit), such as / Figure 2A "; Step 1: from The first character starts to search for 20 characters towards the end of the line (to 'r'), and the remaining width is 10, and the 10 widest characters can also be edited, such as "Figure 2B"; Step 2 : Search for 11 characters from the 21st character to the end of the line (to '), and the remaining width is 3 6. You can also edit the 3 widest characters, such as "Figure 2C"; Steps 3: Search for 4 characters from the 32nd character to the end of the line (to 'e'), the remaining width is 2 2 and you can also edit the 2 widest characters, such as "2D picture" Step 4: The 3rd and 6th characters start searching for 3 characters towards the end of the line (to 'eT), the remaining width is 4, and the 0 widest characters can also be edited, such as "Figure 2E"; Step 5: from The 39th character starts searching for 1 character (to ', blank character) towards the end of the line, and the remaining width is 1, and you can also edit 0 widest characters, such as "2F picture"; Steps 6: Search for 1 character from the 40th character to the end of the line (to 's'), accumulate the character width to exceed the line width, find the next line
第9頁 4 5270 7 五、發明說明(7) 首字元,如「第2G圖」; 步驟7 :從本行首字元向前搜索到空格字元,找出下 行行首字元為’s’*將’s’作為下行首字元,如「第2H 圖」及「第2 I圖」。 【發明之效果】 本發明藉由計算一行所能編輯的最寬字元數,來減少 編輯框中字元換行時累加字元寬度與行寬的比較次數,節 約了時間,提高字元換行的效率。 用精保 非之之 並明明 其發發 然本本。 ,離此準 上脫因為 如不,者 露在飾定 揭,潤界 例者與所 施藝動圍 實技更範 佳此之利 較習許專 一 熟些請 以何作申 已任可之1 明,當附明 發明,後說 本發内視號始 然本圍當符開 雖定範圍示 限和範圖 以神護C10Page 9 4 5270 7 V. Description of the invention (7) The first character, such as "Figure 2G"; Step 7: Search forward from the first character of this line to the space character, find the first character of the lower line is' s '*' Uses 's' as the first character of the descending line, such as "Picture 2H" and "Picture 2I". [Effects of the Invention] The present invention reduces the number of comparisons between the accumulated character width and line width when wrapping characters in the edit box by counting the widest number of characters that can be edited in one line, saving time and improving the efficiency of character wrapping. . Use precision assurance and make it clear that it is issued. If this is not the case, if you are not exposed, the person who is exposed will be exposed. The practice of Runjie and the skill of the performing arts is more good. This is more familiar than the practice of Xu. Please make sure what you can do. When the invention was attached, it was later said that the internal visual number of this hair was originally marked by the scope, although the range was shown and the fan map was protected by the god C10.
一—-234567890 ' _ - - - I I · _-*- I 設取計 度數 寬元 其字 及寬 元最 字的 態寬輯 狀最 始的 初中 作串 操字 定得 編 能 還 行 本 算 元 字 個 1 取 讀 始 開元 元字 字行 始分 相到 鑫貝 /T=口 操否 次是 本斷 從判 元 j字 元3 固 字 1 + 束 N 結了 到取 賣志貝 古D=° 否否 是是 斷斷 判判 度較 寬比 加行 累進 的寬 元元行 字字與 個尋度 1 搜寬 下所加 取算累 讀計將One —-234567890 '_---II · _- *-I I set the number of words and the state of the word and the character of the word in the wide word. The beginning of the junior high school as a string operation can be edited. Metacharacter 1 is taken from the beginning of the metacharacter. The metacharacter line is split into Xinbei / T = oral operation is the second time. From the judgment of the character j character 3 fixed character 1 + bundle N to the sale of Shibegu D = ° No No Yes Judgment is judged to be wider than the progressive wide word and the search word is 1
第10頁 452707 五、發明說明(8) 21 從此位置向前直到本行首字元,搜尋一個單詞分隔 字元 22 把此字元的下下個字元,作為下一行的首字元 23 判斷有單詞分隔字元 24 將此分隔字元的下一個字元作為下一行的首字元 25 將讀取的最後一個字元作為下一行的首字元 26 換行 27 結束·Page 10 452707 V. Description of the invention (8) 21 From this position forward to the first character of the line, search for a word separator 22 Use the next character of this character as the first character 23 of the next line There is a word delimiter 24 The next character of this delimiter is the first character of the next line 25 The last character read is the first character of the next line 26 Newline 27 End
第11頁Page 11
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| TW88119676ATW452707B (en) | 1999-11-11 | 1999-11-11 | String line-changing method |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| TW88119676ATW452707B (en) | 1999-11-11 | 1999-11-11 | String line-changing method |
| Publication Number | Publication Date |
|---|---|
| TW452707Btrue TW452707B (en) | 2001-09-01 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| TW88119676ATW452707B (en) | 1999-11-11 | 1999-11-11 | String line-changing method |
| Country | Link |
|---|---|
| TW (1) | TW452707B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2012058887A1 (en)* | 2010-11-03 | 2012-05-10 | 中兴通讯股份有限公司 | Method for improving rendering speed of browser page |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2012058887A1 (en)* | 2010-11-03 | 2012-05-10 | 中兴通讯股份有限公司 | Method for improving rendering speed of browser page |
| Publication | Publication Date | Title |
|---|---|---|
| Pasha et al. | Madamira: A fast, comprehensive tool for morphological analysis and disambiguation of arabic. | |
| US9400786B2 (en) | Computer-implemented method, computer software and apparatus for use in a translation system | |
| JP2000514218A (en) | Word recognition of Japanese text by computer system | |
| JP3992348B2 (en) | Morphological analysis method and apparatus, and Japanese morphological analysis method and apparatus | |
| WO2017008448A1 (en) | Method for extracting core content of web page | |
| CN104516868B (en) | The streaming restoring method and system in a kind of space of a whole page space | |
| JP2937519B2 (en) | Document search device | |
| CN113553838A (en) | Method and device for generating commodity copywriting | |
| TW452707B (en) | String line-changing method | |
| US8214736B2 (en) | Method and system of identifying textual passages that affect document length | |
| JP6538563B2 (en) | INPUT SUPPORT DEVICE, INPUT SUPPORT METHOD, AND PROGRAM | |
| CN118709647A (en) | Document processing method, device, electronic device and storage medium | |
| CN102541865B (en) | Improve the method for participle performance using the neologisms that participle identifies in the process | |
| CN111435405A (en) | Method and device for automatically labeling key sentences of article | |
| JP2012003517A (en) | Claim structure information generating device, claim structure information generating method, and program | |
| JPH1115830A (en) | Sentence abbreviation device and medium recording sentence abbreviation program | |
| CN116306517A (en) | Text processing model training and title generation methods, devices, equipment and media | |
| JP3966086B2 (en) | Document processing apparatus and method | |
| KR100434526B1 (en) | Sentence extracting method from document by using context information and local document form | |
| US7675527B2 (en) | Multisource composable projection of text | |
| JP5647779B2 (en) | Information processing apparatus, information processing method, and program | |
| JP2008225566A (en) | Related information extraction apparatus and method | |
| CN109740141A (en) | A method of typesetting beautification is carried out to text based on canvas | |
| JPH04167049A (en) | Document processor | |
| JP3628565B2 (en) | Dictionary search method, device, and recording medium recording dictionary search program |
| Date | Code | Title | Description |
|---|---|---|---|
| GD4A | Issue of patent certificate for granted invention patent | ||
| MM4A | Annulment or lapse of patent due to non-payment of fees |