CN104714932A - Displaying method for multi-line characters - Google Patents

Displaying method for multi-line characters Download PDF

Info

Publication number
CN104714932A
CN104714932A CN201510097845.1A CN201510097845A CN104714932A CN 104714932 A CN104714932 A CN 104714932A CN 201510097845 A CN201510097845 A CN 201510097845A CN 104714932 A CN104714932 A CN 104714932A
Authority
CN
China
Prior art keywords
character
width
low
characters
show
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.)
Granted
Application number
CN201510097845.1A
Other languages
Chinese (zh)
Other versions
CN104714932B (en
Inventor
李必龙
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.)
Beijing New World Times Technology Co ltd
Original Assignee
Fujian Newland Communication Science Technology Co Ltd
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 Fujian Newland Communication Science Technology Co Ltd filed Critical Fujian Newland Communication Science Technology Co Ltd
Priority to CN201510097845.1A priority Critical patent/CN104714932B/en
Publication of CN104714932A publication Critical patent/CN104714932A/en
Application granted granted Critical
Publication of CN104714932B publication Critical patent/CN104714932B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Controls And Circuits For Display Device (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The invention provides a displaying method for multi-line characters. The displaying method for the multi-line characters comprises the first step that the width of the paragraph of the characters is obtained by searching from the first character of the paragraph to the line break or carriage return or the end of the paragraph; the number of the characters of the paragraph is assumed to be n, and n belongs to natural numbers; the second step that whether the width of the n characters exceeds the width of the displaying area is judged, and if the width of the n characters does not exceed the width of the displaying area, the n characters of this line are directly displayed, line feed is conducted, the forth step is entered, if the width of the n characters exceeds the width of the displaying area, the third step is entered; the third step that the maximum character number m of the width capable of being displayed within the displaying area is obtained again through searching from the first character to the nth character, the m characters are displayed, then line feed is conducted, wherein the m is smaller than the n; the forth step that the displayed characters are offset, the first step is continuously repeated until the end of the characters of the paragraph. By means of the displaying method for the multi-line characters, the operation effect is good, the refresh frequency is fast, and the performance of a user interface is well improved.

Description

A kind of display packing of multirow character
Technical field
The present invention relates to user's display interface technical field, particularly relate to a kind of display packing of multirow character.
Background technology
Present stage, when showing multirow character in viewing area, the algorithm that the most multipotency of the calculating a line adopted shows how many characters is: whether the width calculated from last character to first character exceedes the width of viewing area, the words being, just recalculate the width from second-to-last character to first character, until the width calculated is less than the width of viewing area, just shows the character of this line and enter a new line.This display mode is quick not, and operational efficiency is low, and does not disclose concrete implementation method.
Summary of the invention
The technical problem to be solved in the present invention, be the display packing providing a kind of multirow character, operational effect is high, and refreshing frequency is fast, well improves the performance of user interface.
The present invention is achieved in that 1, a kind of display packing of multirow character, comprises the steps:
Step 1, from first of this section of character that will show, until the end of newline or carriage return character or this section of character, draw the width of this section of character that will show; If the character number of this section of character is n, n is natural number;
Step 2, judge whether the width of n character exceedes the width of viewing area, is no more than, directly this line of display n character and enter a new line; Enter step 4; Exceed, then enter step 3;
Step 3, to regain from first character to the n-th character, the width of viewing area can not be exceeded, maximum character number m that can show; Show this m character again and enter a new line, wherein m<n;
After the character that step 4, skew are fallen to have shown, continue to repeat step 1, until the end of this section of character.
Further, the mode that described character number m obtains adopts dichotomy, Hash lookup or binary sort tree algorithm to obtain.
Further, the mode that described character number m obtains adopts dichotomy, and described dichotomy specific implementation is as follows:
Step 31, mark low are the first character starting position that will show, and high is the position of last character, just starts, low=1, high=n;
Step 32, obtain from low position, to the width of the character of a position, (low+high)/2;
Step 33, judge whether this width exceedes the width of viewing area, if do not exceeded, low=(low+high)/2; If exceeded, high=(low+high)/2;
Step 34, continue repeat step 32 until do not satisfy condition (high-low) >1 time exit this dichotomy, the low value at this moment obtained is exactly maximum character number m that this row can show.
Tool of the present invention has the following advantages: when the present invention by showing one section of character in viewing area, will enter a new line when exceeding the rightmost of viewing area next line automatically, or also wants enter a new line to arrive next line when run into newline or carriage return character.Like this one of display section of character can be made automatically to enter a new line, and when running into newline or carriage return character, also can automatically enter a new line, the number of comparisons calculating width in the algorithm of the maximum number of the character that often row can show is few, operational efficiency is high, improve the speed of character line feed, refresh fast, optimize user's display interface.
Accompanying drawing explanation
Fig. 1 is the inventive method schematic flow sheet.
Embodiment
Refer to shown in Fig. 1, the display packing of a kind of multirow character of the present invention, comprises the steps:
Step 1, from first of this section of character that will show, until the end of newline or carriage return character or this section of character, draw the width of this section of character that will show; If the character number of this section of character is n, n is natural number;
Step 2, judge whether the width of n character exceedes the width of viewing area, is no more than, directly this line of display n character and enter a new line; Enter step 4; Exceed, then enter step 3;
Step 3, to regain from first character to the n-th character, the width of viewing area can not be exceeded, maximum character number m that can show; Show this m character again and enter a new line, wherein m<n;
After the character that step 4, skew are fallen to have shown, continue to repeat step 1, until the end of this section of character.
Wherein, the mode that described character number m obtains adopts dichotomy, Hash lookup or binary sort tree algorithm to obtain.
Described dichotomy specific implementation is as follows:
Step 31, mark low are the first character starting position that will show, and high is the position of last character, just starts, low=1, high=n;
Step 32, obtain from low position, to the width of the character of a position, (low+high)/2;
Step 33, judge whether this width exceedes the width of viewing area, if do not exceeded, low=(low+high)/2; If exceeded, high=(low+high)/2;
Step 34, continue repeat step 32 until do not satisfy condition (high-low) >1 time exit this dichotomy, the low value at this moment obtained is exactly maximum character number m that this row can show.
The algorithm calculating the character number of often row most multipotency display adopted is very important, and adopt dichotomy few to the number of comparisons of width like this, operational effect is high, and refreshing frequency is fast, well improves the performance of user interface.
In a word, the present invention can make one of display section of character automatically enter a new line, and when running into newline or carriage return character, also can automatically enter a new line, the number of comparisons calculating width in the algorithm of the maximum number of the character that often row can show is few, and operational efficiency is high, improves the speed of character line feed, refresh fast, optimize user's display interface.
The foregoing is only preferred embodiment of the present invention, all equalizations done according to the present patent application the scope of the claims change and modify, and all should belong to covering scope of the present invention.

Claims (3)

1. a display packing for multirow character, is characterized in that: comprise the steps:
Step 1, from first of this section of character that will show, until the end of newline or carriage return character or this section of character, draw the width of this section of character that will show; If the character number of this section of character is n, n is natural number;
Step 2, judge whether the width of n character exceedes the width of viewing area, is no more than, directly this line of display n character and enter a new line; Enter step 4; Exceed, then enter step 3;
Step 3, to regain from first character to the n-th character, the width of viewing area can not be exceeded, maximum character number m that can show; Show this m character again and enter a new line, wherein m<n;
After the character that step 4, skew are fallen to have shown, continue to repeat step 1, until the end of this section of character.
2. the display packing of a kind of multirow character according to claim 1, is characterized in that: the mode that described character number m obtains adopts dichotomy, Hash lookup or binary sort tree algorithm to obtain.
3. the display packing of a kind of multirow character according to claim 1, is characterized in that: the mode that described character number m obtains adopts dichotomy, and described dichotomy specific implementation is as follows:
Step 31, mark low are the first character starting position that will show, and high is the position of last character, just starts, low=1, high=n;
Step 32, obtain from low position, to the width of the character of a position, (low+high)/2;
Step 33, judge whether this width exceedes the width of viewing area, if do not exceeded, low=(low+high)/2; If exceeded, high=(low+high)/2;
Step 34, continue repeat step 32 until do not satisfy condition (high-low) >1 time exit this dichotomy, the low value at this moment obtained is exactly maximum character number m that this row can show.
CN201510097845.1A 2015-03-05 2015-03-05 A kind of display methods of many line characters Active CN104714932B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510097845.1A CN104714932B (en) 2015-03-05 2015-03-05 A kind of display methods of many line characters

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510097845.1A CN104714932B (en) 2015-03-05 2015-03-05 A kind of display methods of many line characters

Publications (2)

Publication Number Publication Date
CN104714932A true CN104714932A (en) 2015-06-17
CN104714932B CN104714932B (en) 2017-08-25

Family

ID=53414278

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510097845.1A Active CN104714932B (en) 2015-03-05 2015-03-05 A kind of display methods of many line characters

Country Status (1)

Country Link
CN (1) CN104714932B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106201009A (en) * 2016-06-24 2016-12-07 维沃移动通信有限公司 A kind of characters input method and electronic equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110185276A1 (en) * 2010-01-28 2011-07-28 Samsung Electronics Co., Ltd. Text output method and apparatus
CN103744636A (en) * 2013-12-30 2014-04-23 上海斐讯数据通信技术有限公司 Text composition method for adapting to window size

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110185276A1 (en) * 2010-01-28 2011-07-28 Samsung Electronics Co., Ltd. Text output method and apparatus
CN103744636A (en) * 2013-12-30 2014-04-23 上海斐讯数据通信技术有限公司 Text composition method for adapting to window size

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
傅建明: "字符串的分割算法研究", 《计算机工程与应用》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106201009A (en) * 2016-06-24 2016-12-07 维沃移动通信有限公司 A kind of characters input method and electronic equipment
CN106201009B (en) * 2016-06-24 2019-05-17 维沃移动通信有限公司 A kind of characters input method and electronic equipment

Also Published As

Publication number Publication date
CN104714932B (en) 2017-08-25

Similar Documents

Publication Publication Date Title
CN101833542B (en) Method and device for rendering fonts of user interface
EP2249262A3 (en) Visual hierarchy explorer
EP2648072A3 (en) Character or word input method, input apparatus and terminal
RU2012146969A (en) MULTI-THREAD ADJUSTMENT OF COLUMN WIDTH AND ROW HEIGHT
JP2010529560A5 (en)
TW200601058A (en) Dynamic buffer allocation method
MY186664A (en) Multimedia file management method, electronic device, and graphical user interface
EP2863320A3 (en) Method, terminal and electronic device for processing an e-book document
GB2512533A (en) Generating a code alphabet of symbols to generate codewords for words used with a program
CN107092655A (en) Circularly exhibiting method and system for organizing figure in Android widescreen equipment
CN104714932A (en) Displaying method for multi-line characters
CN102063494A (en) Database synchronizing method and device
CN101183372B (en) Style list processing system and method
CN101739663B (en) Method and equipment for scaling dot matrix characters
WO2015165228A1 (en) Method and device for managing character texture
US20140075152A1 (en) Method for generating a delta for compressed data
US20130227444A1 (en) Method and Device for Improving Page Rendering Speed of Browser
CN105095106B (en) data block storage method and device
CN103390283A (en) Method and device for drawing parallel curves
WO2015100691A1 (en) Rapid input method convenient to modify for handwriting input device
CN103617113A (en) File version displaying method based on time axis
WO2014186392A3 (en) Summarizing a photo album
WO2010018997A3 (en) Word input method
CN103176953A (en) Text processing method and text processing system
CN1336578A (en) Chinese character inputting method based on digital keypad

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
CB03 Change of inventor or designer information
CB03 Change of inventor or designer information

Inventor after: Li Bilong

Inventor after: Chen Xiaohui

Inventor after: Yuan Wei

Inventor after: Shen Shaoyang

Inventor before: Li Bilong

GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20240403

Address after: No. 17B-S, 15th Floor, Building 22, Shouti South Road, Haidian District, Beijing, 100000

Patentee after: Beijing New World Times Technology Co.,Ltd.

Country or region after: China

Address before: 6 # Building and 2 to 4 # Building of 5 # Building, No. 70, Rujiang East Road, Mawei Development Zone, Fuzhou City, Fujian Province, 350000

Patentee before: Fujian Newland Communication Science Technologies Co.,Ltd.

Country or region before: China