WO2012058887A1 - 一种提高浏览器页面渲染速度的方法和装置 - Google Patents

一种提高浏览器页面渲染速度的方法和装置 Download PDF

Info

Publication number
WO2012058887A1
WO2012058887A1 PCT/CN2011/071299 CN2011071299W WO2012058887A1 WO 2012058887 A1 WO2012058887 A1 WO 2012058887A1 CN 2011071299 W CN2011071299 W CN 2011071299W WO 2012058887 A1 WO2012058887 A1 WO 2012058887A1
Authority
WO
WIPO (PCT)
Prior art keywords
character
font
width
string
library
Prior art date
Application number
PCT/CN2011/071299
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 US13/882,683 priority Critical patent/US20130227444A1/en
Priority to EP11837417.2A priority patent/EP2637109A4/en
Publication of WO2012058887A1 publication Critical patent/WO2012058887A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • 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

Definitions

  • the present invention relates to display technology of a mobile terminal, and more particularly to a method and apparatus for improving the rendering speed of a browser page. Background technique
  • the performance of the mobile terminal's browser is usually related to three technical conditions: one is the download speed of the data, the other is the processing speed of the kernel, and the third is the rendering speed of the page.
  • the first two aspects are systemic problems, and the present invention does not consider, and the third aspect is focused; in general, the faster the rendering speed, the faster the page is displayed, and the smoother the user browses the page.
  • Character rendering systems are often required to display characters in a page during rendering. In a typical character display system, the fonts provided can be roughly divided into two categories:
  • Monospaced font The width of each character in a string is the same.
  • Chinese fonts, Courier and Courier new fonts the types of monospaced fonts are limited, and the font changes are relatively simple.
  • unequal width font The width of each character in the string is not equal, for example: Roman font, True Type, etc., the type of unequal font is richer, the font display is more beautiful .
  • the character display system When dealing with characters, if you encounter a general monospaced font, the character display system is usually displayed in equally spaced fonts. It is also relatively simple to calculate the length of a string. As long as the number of characters is multiplied by the number of characters, the width display length of the string can be calculated.
  • the characters are words in the form of letters combined with words, the form that is displayed in the display is more in line with the habit of writing, and the words displayed.
  • the type can have a variety of changes, and most of them use a non-equal spacing display.
  • the character width occupied by the string cannot be obtained by accumulating the width of the character itself. Therefore, to get the width of a string of unequal width characters or shuffles, especially when you need to calculate the width of a string frequently, the efficiency of calculating the width of a string is very important.
  • the general solution is: scan the string from the beginning for a given string; call the interface function in the font for calculating the width of the string for each character of the string, and get the drawing width of the character; The result accumulates the total width of the string.
  • the need to obtain the font width means that the font engine needs to be called to read the math vector, and then a certain mathematical operation is performed to get the width of the character. If the string is mixed and the number of characters is large, the character width interface function in the font is frequently used, which makes the calculation of the character width very inefficient.
  • the main object of the present invention is to provide a method and apparatus for improving the rendering speed of a browser page, which can improve the efficiency of the browser for calculating the character width.
  • the present invention provides a method for improving the rendering speed of a browser page, the method comprising: setting an initial state of a rendering operation;
  • the character widths of the segments are added to obtain the width of the string, and the string is displayed according to the obtained width.
  • the calculating, by using the font library, the width of each character specifically: determining whether the font of each character is a monospaced font, and if so, obtaining a maximum width value of the font from the font library, and calculating according to the number of characters
  • the width of the character if not, the interface function of the font in the font library is called to calculate the width of the character.
  • the method further includes: if the interface function for the font is not found, creating the font in the font library, and determining the width value of the character, and saving the font in the font library. in.
  • the segmentation of the character string according to the font of the character is specifically: sequentially reading each character, if the font of the read character does not change, belongs to the same segment; if the font of the read character changes, It belongs to the next paragraph until the last character of the string is read.
  • the initial state of the setting rendering operation is specifically: initializing a font library, and an interface function corresponding to various fonts in the font library.
  • the character string is segmented according to the font of the character, and the width of each character is calculated by using the font library, including: After reading the character string as a whole, according to the font of each segment character, the segment characters are uniformly calculated according to the classification of the font. Width; or, in the process of reading a string, when the character changes, calculate the character width of the previous paragraph.
  • the present invention also provides an apparatus for improving the rendering speed of a browser page, the apparatus comprising: a font library and a character processing module, wherein
  • the font library is configured to accept a setting of an initial state of a rendering operation
  • the character processing module is configured to start from a first character of a character string, segment a character string according to a font of the character, calculate a width of each character by using a font library, and add a character width of each segment to obtain a width of the character string. Displays a string based on the resulting width.
  • the method and device for improving the rendering speed of a browser page provided by the present invention, by setting the initial state of the rendering operation; starting from the first character of the string, segmenting the string according to the font of the character, and calculating each character by using the font library Width; adds the character width of each segment to get the width of the string, and displays the string according to the resulting width.
  • the interface function can be called repeatedly without calling the interface function, which reduces the number of times the font library interface function is called to calculate the character width, thereby reducing the number of characters.
  • the resource overhead increases the efficiency of calculating character widths.
  • the present invention can create an unknown font in the font library, so that when the font appears again, the character width of the created font can be directly invoked, which can also improve the speed of page rendering and improve the user experience.
  • FIG. 1 is a schematic flow chart of a method for improving the rendering speed of a browser page according to the present invention
  • FIG. 2 is a schematic structural diagram of an apparatus for improving the rendering speed of a browser page according to the present invention. detailed description
  • the basic idea of the present invention is: setting the initial state of the rendering operation; starting from the first character of the string, segmenting the string according to the font of the character, using the font library to calculate the width of each segment of the character; Add the width of the string and display the string based on the resulting width.
  • FIG. 1 is a schematic flowchart of a method for improving a rendering speed of a browser page according to the present invention. As shown in FIG. 1 , the method includes:
  • Step 101 Set an initial state of the rendering operation.
  • the initial state of the setting rendering operation includes: initializing a character width of each font stored in the font library, and an interface function corresponding to the various unequal width fonts in the font library; the interface function is used to calculate each The character width of a unequal width font.
  • Step 102 Starting from the first character of the string, segmenting the string according to the font of the character, and calculating the width of each character by using the font library;
  • the character string is segmented according to the font of the character, specifically: sequentially reading each character, if the font of the read character does not change, the characters read are the same font, and belong to the same segment;
  • the font change of the read character indicates that the read character is different from the font of the previous character and belongs to the next paragraph until the last character of the string is read.
  • the calculating a width of each character by using a font library includes: determining that a font of each character is No is a monospaced font, if yes, the maximum width value of the font is obtained from the font library, and the width of the character is calculated according to the number of characters; if not, the interface function corresponding to the font in the font library is called, and the character is calculated. width.
  • the interface function for the font if the interface function for the font is not found, it indicates that the processed font does not exist in the font library, and the determination belongs to the unknown font.
  • the font is created in the font library, and according to the information carried by the font itself, such as: font separation, whether the font is bold or the like, the width value of the character is determined and saved in the font library. Thus, when this unknown font appears again, its width value can be called directly.
  • the character string is segmented according to the font of the character, and the width of each character is calculated by using the font library, and the method further comprises: after reading the character string as a whole, according to the font of each segment character, uniformly calculating each according to the font classification The width of the segment character; or, in the process of reading the string, when the character changes, the character width of the previous segment is calculated.
  • Step 103 Add the character widths of the segments to obtain the width of the string, and display the string according to the obtained width.
  • the method further includes: determining whether there is still a new character string to be calculated, if yes, performing step 102; otherwise, ending the processing flow.
  • the efficiency of calculating the character width of the present invention is much higher than that of the prior art, especially in the page rendering process of a mobile terminal browser that frequently processes a large number of mixed characters.
  • The width of the unknown font
  • the width of the widest character is iMaxWidth, which only needs to be calculated once at the time of creation.
  • the iMaxWidth value can be directly used each time to obtain the font width.
  • the time cost is almost 0ms.
  • the interface function of the font library must be called to calculate the character width when encountering a unequal width font, the time cost of calling the interface function is several milliseconds to tens of milliseconds. However, by segmentation calculation, you can save the time of calling the interface function character by character.
  • Table 1 is the time to open a web page before and after using the method provided by the present invention. Among them, the serial number from 1 to 5 indicates that the other conditions are the same, and the website www, 2 ⁇ dnri, coin is opened five times in a row. Make The data before and after the use of the present invention is the time at which the web page is opened, in seconds.
  • the apparatus includes: a font library 21, and a character processing module 22, wherein
  • the font library 21 is configured to accept a setting of an initial state of the rendering operation
  • the font library 21 accepts the setting of the initial state of the rendering operation, and includes: initializing the character widths of the various fonts stored in the font library 21, and interface functions corresponding to the various unequal width fonts in the font library 21;
  • the interface function is used to calculate the character width of various unequal width fonts.
  • the character processing module 22 is configured to start from the first character of the character string, segment the character string according to the font of the character, calculate the width of each character segment by using the font library 21, and add the character widths of the segments to obtain a character string. Width, the string is displayed according to the width obtained.
  • the character processing module 22 segments the character string according to the font of the character, specifically: sequentially reading the characters, and when the font of the read character does not change, the characters read are the same font, and belong to the same segment. When the font of the read character changes, the character read is a different font, belonging to the next paragraph, until the last character of the string is read.
  • the character processing module 22 calculates the width of each character by using the font library 21, including: determining whether the font of each character is a monospaced font, and when the font is a monospaced font, acquiring the font from the font library 21.
  • the maximum width value of the font, the width of the character is calculated according to the number of characters; when it is not a monospaced font, the interface function corresponding to the font in the font library 21 is called to calculate the width of the character.
  • the character processing module 22 calls the interface function of the font library 21, if the interface function for the font is not found, it indicates that the processed font does not exist in the font library, and the determination belongs to the unknown font.
  • the font is created in the font library 21, and the width value of the character is determined according to the information carried by the font itself, for example, font separation, whether the font is bold or the like, and is stored in the font library 21.
  • the width value can be called directly.
  • the character processing module 22 segments the character string according to the font of the character, and calculates the width of each character by using the font library 21, and further includes: after reading the character string as a whole, according to the font of each segment character, according to the font The classification calculates the width of each segment of the character uniformly; or, in the process of reading the string, when the character changes, the character width of the previous segment is calculated.
  • the character processing module 22 is further configured to determine whether a new character string needs to be calculated, and if so, restart the segmentation of the character string from the first character and calculate if the operation is not stopped.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Controls And Circuits For Display Device (AREA)

Description

一种提高浏览器页面渲染速度的方法和装置 技术领域
本发明涉及移动终端的显示技术, 特别是指一种提高浏览器页面渲染 速度的方法和装置。 背景技术
随着移动通信技术的发展, 用户越来越多的使用移动终端中的浏览器 进行页面浏览等操作。 移动终端的浏览器的性能通常与三个技术条件相关: 一是数据的下载速度, 二是内核的处理速度, 三是页面的渲染速度。 前两 个方面属于系统性问题, 本发明不考虑, 重点在于第三个方面; 通常, 渲 染速度越快, 则页面显示的越快, 用户浏览页面感觉越流畅。 在渲染的过 程中通常都需要使用字符显示系统来显示页面中的字符。 在一般的字符显 示系统中, 所提供的字体大致上可以分为两类:
1、 等宽字体: 指字符串中的每个字符的宽度都相同。 例如: 中文字体、 书信体(Courier ) 以及宋体(Courier new )等几种字体, 等宽字体的种类 有限, 字型的变化也比较简单。
2、 不等宽字体: 指字符串中的每个字符的宽度都不相等, 例如: 罗马 字体、 全真字体(True Type )等, 不等宽字体的种类较丰富, 字体的显示 效果比较美观。
在处理字符的时候, 如果遇到一般的等宽字体, 字符显示系统通常是 以等间距的字体来显示。 在计算字符串长度的计算上也比较简单, 只要将 字符的个数乘以字符的个数, 就可以计算出字符串的宽度显示长度。 但对 于通常的西文字体, 即文字是以字母组合以单词为单位的形态的文字, 力 求在显示中所表现出的形态能更加符合平时书写的习惯, 以及显示出的字 型能有丰富的变化效果, 多半釆用非等间距的显示方式。
在不等宽字体, 或者不等宽和等宽字体混排而构成的字符串中, 字符 串所占用的字符宽度不能靠累加字符自身的宽度而获得。 因此, 要获得不 等宽字符或者混排组成的字符串的宽度, 尤其是在需要频繁计算字符串宽 度的时候, 计算字符串宽度的效率就非常的重要。 一般的解决方法是: 针 对给定的字符串, 从头扫描字符串; 对字符串的每个字符分别调用字库中 用于计算字符串宽度的接口函数, 获得该种字符的绘制宽度; 最后将计算 的结果累加获得字符串的总的宽度。 如此, 对于不等宽字体, 需要获取字 体宽度就意味着需要调用字体引擎读取数学矢量, 然后进行一定的数学运 算才能得到字符的宽度。 如果字符串混排度高, 字符量大, 就要频繁的调 用字库中的字符宽度接口函数, 使得字符宽度计算的运算效率非常低。 发明内容
有鉴于此, 本发明的主要目的在于提供一种提高浏览器页面渲染速度 的方法和装置, 能够提高浏览器计算字符宽度的效率。
为达到上述目的, 本发明的技术方案是这样实现的:
本发明提供了一种提高浏览器页面渲染速度的方法, 所述方法包括: 设定渲染操作的初始状态;
从字符串的首字符开始, 根据字符的字体对字符串分段, 利用字体库 计算每段字符的宽度;
将各段的字符宽度相加得到字符串的宽度, 根据得到的宽度显示字符 串。
其中, 所述利用字体库计算每段字符的宽度, 具体为: 判断每段字符 的字体是否是等宽字体, 如果是, 则从字体库中获取该字体的最大宽度值, 根据字符数量累加计算字符的宽度; 如果不是, 则调用字体库中该字体的 接口函数, 计算字符的宽度。 其中, 所述调用字体库的接口函数的过程中, 所述方法还包括: 如果 没有发现针对字体的接口函数, 则在字体库中创建该字体, 并确定其字符 的宽度值, 保存在字体库中。
其中, 所述根据字符的字体对字符串分段, 具体为: 依次读取每个字 符, 如果所读取的字符的字体没有变化, 则属于同一段; 如果所读取字符 的字体变化, 则属于下一段, 直至读取到字符串的末字符。
其中, 所述设定渲染操作的初始状态, 具体为: 初始化字体库, 以及 字体库中对应各种字体的接口函数。
其中, 所述根据字符的字体对字符串分段, 利用字体库计算每段字符 的宽度, 包括: 整体读取完字符串后, 按照各段字符的字体, 根据字体的 分类统一计算各段字符的宽度; 或者, 在读取字符串的过程中, 当字符变 化时, 计算上一段的字符宽度。
本发明还提供了一种提高浏览器页面渲染速度的装置, 所述装置包括: 字体库和字符处理模块, 其中,
所述字体库, 用于接受渲染操作的初始状态的设定;
所述字符处理模块, 用于从字符串的首字符开始, 根据字符的字体对 字符串分段, 利用字体库计算每段字符的宽度, 将各段的字符宽度相加得 到字符串的宽度, 根据得到的宽度显示字符串。
本发明所提供的提高浏览器页面渲染速度的方法和装置, 通过设定渲 染操作的初始状态; 从字符串的首字符开始, 根据字符的字体对字符串分 段, 利用字体库计算每段字符的宽度; 将各段的字符宽度相加得到字符串 的宽度, 根据得到的宽度显示字符串。 如此, 本发明中如果有连续的同字 体的不等宽字符就可以不用反复调用接口函数, 调用一次即可, 这样减少 了调用字体库接口函数计算字符宽度的次数, 降低了由此而带来的资源开 销, 提高了计算字符宽度的效率。 进一步的, 本发明能对未知字体在字体库中进行创建, 使得再次出现 该字体时, 可以直接调用所述创建的字体的字符宽度, 同样能够提高页面 渲染的速度, 改善了用户体验。 附图说明
图 1为本发明一种提高浏览器页面渲染速度的方法流程示意图; 图 2为本发明一种提高浏览器页面渲染速度的装置结构示意图。 具体实施方式
本发明的基本思想是: 设定渲染操作的初始状态; 从字符串的首字符 开始, 根据字符的字体对字符串分段, 利用字体库计算每段字符的宽度; 将各段的字符宽度相加得到字符串的宽度, 根据得到的宽度显示字符串。
下面结合附图和具体实施例对本发明的技术方案进一步详细阐述。 图 1为本发明一种提高浏览器页面渲染速度的方法流程示意图,如图 1 所示, 所述方法包括:
步骤 101 , 设定渲染操作的初始状态;
具体的, 所述设定渲染操作的初始状态包括: 初始化字体库中存储的 各种字体的字符宽度, 以及字体库中对应各种不等宽字体的接口函数; 所 述接口函数用于计算各种不等宽字体的字符宽度。
步骤 102, 从字符串的首字符开始, 根据字符的字体对字符串分段, 利 用字体库计算每段字符的宽度;
具体的, 所述根据字符的字体对字符串分段, 具体是: 依次读取每个 字符, 如果所读取的字符的字体没有变化, 说明读取的字符是相同字体, 属于同一段; 如果所读取字符的字体变化, 则说明读取的字符与上一个字 符的字体不同, 属于下一段, 直至读取到字符串的末字符。
所述利用字体库计算每段字符的宽度, 包括: 判断每段字符的字体是 否为等宽字体, 如果是, 则从字体库中获取该字体的最大宽度值, 根据字 符数量累加计算字符的宽度; 如果不是, 则调用字体库中对应这种字体的 接口函数, 计算字符的宽度。
进一步的, 调用字体库的接口函数的过程中, 如果没有发现针对这种 字体的接口函数, 说明所处理的字体不存在于字体库中, 判定属于未知字 体。 此时在字体库中创建该字体, 并根据该字体自身携带的信息, 例如: 字体分隔、 字体是否加粗等信息, 确定其字符的宽度值, 保存在字体库中。 这样, 当这种未知字体再次出现时, 可以直接调用其宽度值。
进一步的, 所述根据字符的字体对字符串分段, 利用字体库计算每段 字符的宽度, 还包括: 整体读取完字符串后, 按照各段字符的字体, 根据 字体的分类统一计算各段字符的宽度; 或者, 在读取字符串的过程中, 当 字符变化时, 计算上一段的字符宽度。
步骤 103 , 将各段的字符宽度相加得到字符串的宽度,根据得到的宽度 显示字符串。
进一步的, 在步骤 103之后, 所述方法还包括: 判断是否还有新的字 符串需要计算, 如果有则执行步骤 102 , 否则结束处理流程。
本发明的计算字符宽度的效率比现有技术提高很多, 尤其是在频繁大 量处理混排字符的移动终端浏览器的页面渲染过程中。 殳: 等宽的未知 字体的最宽字符的宽度为 iMaxWidth, 只需要在创建时计算一次, 以后每次 要获取字体宽度时都可以直接取用所述 iMaxWidth值, 时间代价几乎是 0ms。 虽然遇到不等宽字体时必须调用字体库的接口函数计算字符宽度, 调 用接口函数的时间代价是数个毫秒到数十个毫秒不等。 但是通过分段计算, 可以节省逐个字符的调用接口函数的时间。
表 1 是使用本发明提供的方法前后打开网页的时间。 其中, 序号从 1 至 5表示其它条件都相同的前提下,连续 5次打开网站 www,2〗 dnri,coin。使 用本发明前和使用本发明后的数据是打开网页的时间, 单位为秒。
Figure imgf000008_0001
表 1
从表 1 中可以看出浏览器的性能有了提高。 并且针对不同的页面进行 测试可知, 页面的字符串数量越小, 渲染速度提高的越小; 页面的字符串 数量和复杂度越大, 渲染速度提高也越大。 使用本发明提供的方法后, 移 动终端浏览器打开网页的速度明显提高, 改善了用户体验。
图 2为本发明一种提高浏览器页面渲染速度的装置结构示意图,如图 2 所示, 所述装置包括: 字体库 21 , 字符处理模块 22 , 其中,
所述字体库 21 , 用于接受渲染操作的初始状态的设定;
具体的, 所述字体库 21接受渲染操作的初始状态的设定, 包括: 初始 化字体库 21 中存储的各种字体的字符宽度, 以及字体库 21 中对应各种不 等宽字体的接口函数; 所述接口函数用于计算各种不等宽字体的字符宽度。
所述字符处理模块 22 , 用于从字符串的首字符开始, 根据字符的字体 对字符串分段, 利用字体库 21计算每段字符的宽度, 将各段的字符宽度相 加得到字符串的宽度, 根据得到的宽度显示字符串。
具体的,所述字符处理模块 22根据字符的字体对字符串分段,具体是: 依次读取字符, 所读取的字符的字体没有变化时, 说明读取的字符是相同 字体, 属于同一段; 所读取字符的字体变化时, 说明读取的字符是不同字 体, 属于下一段, 直至读取到字符串的末字符。
所述字符处理模块 22利用字体库 21计算每段字符的宽度, 包括: 判 断每段字符的字体是否为等宽字体, 是等宽字体时, 从字体库 21中获取该 字体的最大宽度值, 根据字符数量累加计算字符的宽度; 不是等宽字体时, 调用字体库 21中对应这种字体的接口函数计算字符的宽度。
进一步的, 所述字符处理模块 22调用字体库 21的接口函数的过程中, 如果没有发现针对这种字体的接口函数, 说明所处理的字体不存在于字体 库中, 判定属于未知字体。 此时在字体库 21中创建该字体, 并根据该字体 自身携带的信息, 例如: 字体分隔、 字体是否加粗等信息, 确定其字符的 宽度值, 保存在字体库 21中。 这样, 当所述未知字体再次出现时, 可以直 接调用其宽度值。
进一步的, 所述字符处理模块 22根据字符的字体对字符串分段, 利用 字体库 21计算每段字符的宽度, 还包括: 整体读取完字符串后, 按照各段 字符的字体, 根据字体的分类统一计算各段字符的宽度; 或者, 在读取字 符串的过程中, 当字符变化时, 计算上一段的字符宽度。
进一步的, 所述字符处理模块 22, 还用于判断是否还有新的字符串需 要计算, 如果有则重新开始从首字符开始对字符串分段并计算, 如果没有 停止操作。
以上所述, 仅为本发明的较佳实施例而已, 并非用于限定本发明的保 护范围, 凡在本发明的精神和原则之内所作的任何修改、 等同替换和改进 等, 均应包含在本发明的保护范围之内。

Claims

权利要求书
1、一种提高浏览器页面渲染速度的方法,其特征在于, 所述方法包括: 设定渲染操作的初始状态;
从字符串的首字符开始, 根据字符的字体对字符串分段, 利用字体库 计算每段字符的宽度;
将各段的字符宽度相加得到字符串的宽度, 根据得到的宽度显示字符 串。
2、 根据权利要求 1所述的方法, 其特征在于, 所述利用字体库计算每 段字符的宽度, 为: 判断每段字符的字体是否是等宽字体, 如果是, 则从 字体库中获取该字体的最大宽度值, 根据字符数量累加计算字符的宽度; 如果不是, 则调用字体库中该字体的接口函数, 计算字符的宽度。
3、 根据权利要求 2所述的方法, 其特征在于, 所述调用字体库的接口 函数的过程中, 所述方法还包括: 如果没有发现针对字体的接口函数, 则 在字体库中创建该字体, 并确定其字符的宽度值, 保存在字体库中。
4、 根据权利要求 1或 2所述的方法, 其特征在于, 所述根据字符的字 体对字符串分段, 为: 依次读取每个字符, 如果所读取的字符的字体没有 变化, 则属于同一段; 如果所读取字符的字体变化, 则属于下一段, 直至 读取到字符串的末字符。
5、 根据权利要求 1或 2所述的方法, 其特征在于, 所述设定渲染操作 的初始状态, 为: 初始化字体库, 以及字体库中对应各种字体的接口函数。
6、 根据权利要求 1或 2所述的方法, 其特征在于, 所述根据字符的字 体对字符串分段, 利用字体库计算每段字符的宽度, 包括: 整体读取完字 符串后, 按照各段字符的字体, 根据字体的分类统一计算各段字符的宽度; 或者, 在读取字符串的过程中, 当字符变化时, 计算上一段的字符宽度。
7、一种提高浏览器页面渲染速度的装置,其特征在于, 所述装置包括: 字体库和字符处理模块, 其中,
所述字体库, 用于接受渲染操作的初始状态的设定;
所述字符处理模块, 用于从字符串的首字符开始, 根据字符的字体对 字符串分段, 利用字体库计算每段字符的宽度, 将各段的字符宽度相加得 到字符串的宽度, 根据得到的宽度显示字符串。
8、 根据权利要求 7所述的装置, 其特征在于, 所述字符处理模块利用 字体库计算每段字符的宽度, 为: 判断每段字符的字体是否是等宽字体, 是等宽字体时, 从字体库中获取该字体的最大宽度值, 根据字符数量累加 计算字符的宽度; 不是等宽字体时, 调用字体库中该字体的接口函数计算 字符的宽度。
9、 根据权利要求 8所述的装置, 其特征在于, 所述字符处理模块调用 字体库的接口函数, 还包括: 没有发现针对字体的接口函数时, 在字体库 中创建该字体, 并确定其字符的宽度值, 保存在字体库中。
10、 根据权利要求 7或 8所述的装置, 其特征在于, 所述字符处理模 块根据字符的字体对字符串分段, 为: 依次读取每个字符, 所读取的字符 的字体没有变化时, 属于同一段; 所读取字符的字体变化时, 属于下一段, 直至读取到字符串的末字符。
PCT/CN2011/071299 2010-11-03 2011-02-25 一种提高浏览器页面渲染速度的方法和装置 WO2012058887A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US13/882,683 US20130227444A1 (en) 2010-11-03 2011-02-25 Method and Device for Improving Page Rendering Speed of Browser
EP11837417.2A EP2637109A4 (en) 2010-11-03 2011-02-25 METHOD FOR IMPROVING THE PRESENCE SPEED OF WEBSITES

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201010531112.1 2010-11-03
CN201010531112.1A CN101986289B (zh) 2010-11-03 2010-11-03 一种提高浏览器页面渲染速度的方法和装置

Publications (1)

Publication Number Publication Date
WO2012058887A1 true WO2012058887A1 (zh) 2012-05-10

Family

ID=43710637

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/071299 WO2012058887A1 (zh) 2010-11-03 2011-02-25 一种提高浏览器页面渲染速度的方法和装置

Country Status (4)

Country Link
US (1) US20130227444A1 (zh)
EP (1) EP2637109A4 (zh)
CN (1) CN101986289B (zh)
WO (1) WO2012058887A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015090064A1 (zh) * 2013-12-19 2015-06-25 华为技术有限公司 页面渲染方法及装置

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102147790B (zh) * 2011-04-15 2012-12-19 华为软件技术有限公司 文本排版方法及排版引擎
CN102364961B (zh) * 2011-11-18 2014-04-23 百视通网络电视技术发展有限责任公司 基于iptv中电子节目指南页面的字符截取方法及系统
CN105955935A (zh) * 2016-04-29 2016-09-21 乐视控股(北京)有限公司 一种文字控件的实现方法及其装置
CN107172474B (zh) * 2017-03-31 2020-02-04 武汉斗鱼网络科技有限公司 一种利用画布绘制弹幕的方法及装置

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5185818A (en) * 1991-06-05 1993-02-09 Adobe Systems Incorporated Method of substituting fonts and displaying characters
JPH06266339A (ja) * 1993-03-12 1994-09-22 Fuji Xerox Co Ltd 文字出力装置
US5519824A (en) * 1994-03-18 1996-05-21 Timex Corporation System and method for storing and displaying font data representing fixed-width and compressed characters
JPH08129373A (ja) * 1994-10-31 1996-05-21 Canon Inc 文字処理装置及び方法
JPH08335069A (ja) * 1995-06-07 1996-12-17 Sharp Corp 文字列出力装置
US5590260A (en) * 1993-12-30 1996-12-31 International Business Machines Corporation Method and apparatus for optimizing the display of fonts in a data processing system
JPH11203400A (ja) * 1998-01-16 1999-07-30 Ricoh Co Ltd 文字入力装置および文字入力方法,並びに文字入力方法をコンピュータに実行させるプログラムを記録した機械読み取り可能な記録媒体
TW452707B (en) * 1999-11-11 2001-09-01 Inventec Corp String line-changing method
JP2006113495A (ja) * 2004-10-18 2006-04-27 Kakei Gakuen ブラウジング可能な電子表示装置
CN1828602A (zh) * 2006-04-10 2006-09-06 浙江大学 基于移动终端wap浏览器显示输出的实现方法
CN101625700A (zh) * 2009-08-12 2010-01-13 中兴通讯股份有限公司 在终端上优化显示网络页面的方法和装置

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0785066A (ja) * 1993-09-10 1995-03-31 Matsushita Electric Ind Co Ltd 画像検索装置
US5895478A (en) * 1996-08-08 1999-04-20 U S West, Inc. Right and center font justification for a document system library
US20020087702A1 (en) * 2000-12-29 2002-07-04 Koichi Mori Remote contents displaying method with adaptive remote font
CN1159666C (zh) * 2002-03-29 2004-07-28 上海汉峰信息科技有限公司 基于笔划中心线技术的曲线字形的还原显示方法
US7030881B2 (en) * 2003-03-25 2006-04-18 Mitsubishi Electric Research Laboratories, Inc. Method for converting two-dimensional objects to distance fields
KR100718139B1 (ko) * 2005-11-04 2007-05-14 삼성전자주식회사 영상에 포함된 문자 인식장치 및 방법
US20080120541A1 (en) * 2006-11-22 2008-05-22 Dynacomware Taiwan Inc. System and method for on-line retrieval and typing of non-standard characters

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5185818A (en) * 1991-06-05 1993-02-09 Adobe Systems Incorporated Method of substituting fonts and displaying characters
JPH06266339A (ja) * 1993-03-12 1994-09-22 Fuji Xerox Co Ltd 文字出力装置
US5590260A (en) * 1993-12-30 1996-12-31 International Business Machines Corporation Method and apparatus for optimizing the display of fonts in a data processing system
US5519824A (en) * 1994-03-18 1996-05-21 Timex Corporation System and method for storing and displaying font data representing fixed-width and compressed characters
JPH08129373A (ja) * 1994-10-31 1996-05-21 Canon Inc 文字処理装置及び方法
JPH08335069A (ja) * 1995-06-07 1996-12-17 Sharp Corp 文字列出力装置
JPH11203400A (ja) * 1998-01-16 1999-07-30 Ricoh Co Ltd 文字入力装置および文字入力方法,並びに文字入力方法をコンピュータに実行させるプログラムを記録した機械読み取り可能な記録媒体
TW452707B (en) * 1999-11-11 2001-09-01 Inventec Corp String line-changing method
JP2006113495A (ja) * 2004-10-18 2006-04-27 Kakei Gakuen ブラウジング可能な電子表示装置
CN1828602A (zh) * 2006-04-10 2006-09-06 浙江大学 基于移动终端wap浏览器显示输出的实现方法
CN101625700A (zh) * 2009-08-12 2010-01-13 中兴通讯股份有限公司 在终端上优化显示网络页面的方法和装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP2637109A4 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015090064A1 (zh) * 2013-12-19 2015-06-25 华为技术有限公司 页面渲染方法及装置

Also Published As

Publication number Publication date
CN101986289B (zh) 2014-08-13
EP2637109A4 (en) 2014-11-19
EP2637109A1 (en) 2013-09-11
US20130227444A1 (en) 2013-08-29
CN101986289A (zh) 2011-03-16

Similar Documents

Publication Publication Date Title
US9824269B2 (en) Enhanced interpretation of character arrangements
US8819028B2 (en) System and method for web content extraction
WO2012058887A1 (zh) 一种提高浏览器页面渲染速度的方法和装置
US20120102401A1 (en) Method and apparatus for providing text selection
US20120293427A1 (en) Information processing control device
US9513784B2 (en) Method and device of controlling input for input boxes
US9934206B2 (en) Method and apparatus for extracting web page content
KR20090109585A (ko) 문맥적 입력 방법
CN106325687B (zh) 一种调用程序的方法及终端
WO2022032917A1 (zh) 一种基于RNN的Webshell检测方法及装置
US20180107650A1 (en) Techniques for scheduling language models and character recognition models for handwriting inputs
CN113050808B (zh) 在输入框中突出显示目标文本的方法及装置
CN111159594A (zh) 信息处理方法、信息处理装置及终端设备
TW201804341A (zh) 字串的分詞方法、裝置及設備
CN101937429B (zh) 移动终端的网页排版方法及系统
CN105320641B (zh) 一种文本校验方法及用户终端
CN111143731B (zh) 一种网页界面缩放时的显示方法、装置及终端设备
CN107766549A (zh) 文本文件删除方法及装置、终端装置与可读存储介质
CN116933728A (zh) 文本处理方法、电子设备及存储介质
CN116484215A (zh) 基于扩散模型的文本生成模型训练、文字生成方法和装置
CN111507067A (zh) 显示公式图片的获取方法、转存公式图片的方法及装置
WO2014176903A1 (zh) 文本处理方法及移动终端
WO2014187202A1 (zh) 实现网页布局的方法、装置、终端及计算机存储介质
JP2014164692A (ja) 文書表示装置、文書表示方法及び文書表示プログラム
CN111651969B (zh) 样式迁移

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: 11837417

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 13882683

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

REEP Request for entry into the european phase

Ref document number: 2011837417

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 2011837417

Country of ref document: EP