[go: up one dir, main page]

CN105047181A - Method and device for displaying characters - Google Patents

Method and device for displaying characters Download PDF

Info

Publication number
CN105047181A
CN105047181A CN201510473668.2A CN201510473668A CN105047181A CN 105047181 A CN105047181 A CN 105047181A CN 201510473668 A CN201510473668 A CN 201510473668A CN 105047181 A CN105047181 A CN 105047181A
Authority
CN
China
Prior art keywords
character
characters
information
displayed
unicode
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201510473668.2A
Other languages
Chinese (zh)
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.)
Guangdong Genius Technology Co Ltd
Original Assignee
Guangdong Genius 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 Guangdong Genius Technology Co Ltd filed Critical Guangdong Genius Technology Co Ltd
Priority to CN201510473668.2A priority Critical patent/CN105047181A/en
Publication of CN105047181A publication Critical patent/CN105047181A/en
Pending legal-status Critical Current

Links

Landscapes

  • Controls And Circuits For Display Device (AREA)

Abstract

本发明实施例公开了一种显示字符的方法及装置,通过获取待显示字符的编码信息,所述编码信息包括Unicode编码;根据所述编码信息确定所述待显示字符是否在预先存储的编码信息中;若是,则直接从预先存储的编码信息中获取所述待显示字符的轮廓信息,根据所述轮廓信息绘制字符图形并显示所述待显示字符,从而全面提高矢量字体的显示速度,有效提高系统运行速度,提高用户体验;并能节省系统资源,有效省电,提供更长的续航能力。

The embodiment of the present invention discloses a method and device for displaying characters, which obtains encoding information of characters to be displayed, wherein the encoding information includes Unicode encoding; determines whether the characters to be displayed are in pre-stored encoding information according to the encoding information; if so, directly obtains contour information of the characters to be displayed from the pre-stored encoding information, draws character graphics according to the contour information and displays the characters to be displayed, thereby comprehensively improving the display speed of vector fonts, effectively improving the system operation speed, and improving the user experience; and can save system resources, effectively save power, and provide longer battery life.

Description

一种显示字符的方法及装置A method and device for displaying characters

技术领域technical field

本发明实施例涉及移动终端的技术领域,尤其涉及一种显示字符的方法及装置。Embodiments of the present invention relate to the technical field of mobile terminals, and in particular to a method and device for displaying characters.

背景技术Background technique

随着嵌入式系统的发展和应用,在嵌入式系统中使用高质量的字体已成为行业的趋势,高效地显示美观大方的字体已成为当前市场的需求,尤其是与人们生活密切相关的通信设备中。With the development and application of embedded systems, the use of high-quality fonts in embedded systems has become an industry trend. Efficiently displaying beautiful and generous fonts has become the current market demand, especially for communication devices that are closely related to people's lives middle.

点阵字体是把每一个字符都分成16×16或24×24个点,然后用每个点的虚实来表示字符的轮廓。点阵字体也叫位图字体,其中每个字形都以一组二维像素信息表示。点阵字体优点是显示速度快,不像矢量字体需要复杂的计算。但由于点阵字体本身的限制,点阵字体很难进行缩放,特定的点阵字体只能清晰地显示在相应的字号下,否则文字只被强行放大而失真字形,产生成马赛克式的锯齿边缘。矢量字体(Vectorfont)中每一个字形是通过数学曲线来描述的,它包含了字形边界上的关键点,连线的导数信息等,字体的渲染引擎通过读取这些数学矢量,然后进行一定的数学运算来进行渲染。这类字体的优点是字体实际尺寸可以任意缩放而不变形、变色,并实现字体的旋转、倾斜等操作,方便的实现“所见所得”。矢量字体主要包括Type1、TrueType、OpenType等几类。但是由于矢量字体在生成字模的时候,需要提取字体描述信息通过数学模型大量计算得到字模,先对于点阵字体来说,显示速度很慢。Dot-matrix fonts divide each character into 16×16 or 24×24 dots, and then use the virtual reality of each dot to represent the outline of the character. Bitmap fonts are also called bitmap fonts, in which each glyph is represented by a set of two-dimensional pixel information. The advantage of dot matrix fonts is that the display speed is fast, unlike vector fonts that require complex calculations. However, due to the limitations of the dot matrix font itself, it is difficult to scale the dot matrix font, and the specific dot matrix font can only be clearly displayed in the corresponding font size, otherwise the text will only be forcibly enlarged and the font will be distorted, resulting in a mosaic jagged edge . Each glyph in a vector font (Vectorfont) is described by a mathematical curve, which contains key points on the glyph boundary, derivative information of the connection, etc., and the rendering engine of the font reads these mathematical vectors, and then performs certain mathematics operation for rendering. The advantage of this type of font is that the actual size of the font can be scaled arbitrarily without deformation or color change, and operations such as rotation and tilting of the font can be realized, which facilitates the realization of "what you see and what you get". Vector fonts mainly include Type1, TrueType, OpenType and other categories. However, when vector fonts generate fonts, font description information needs to be extracted to obtain fonts through a large number of calculations through mathematical models. First, for dot matrix fonts, the display speed is very slow.

目前做法都是矢量字体的常规做法,先提取字符的轮廓信息,然后计算出该字符的字模,再输出到屏幕;这样做法都很影响显示的效率,没有把有用的字符信息提前准备好,比如说字符的宽高信息;如果要使用才去从字库读取的话,那是很耗时的;再比如说;每次绘制字符是,都是通过文件系统去字库读取相关信息;而通过文件系统读取字符信息是很慢的;大大降低了效率。The current method is the conventional method of vector fonts. First extract the outline information of the character, then calculate the font of the character, and then output it to the screen; this method will affect the efficiency of the display, and the useful character information is not prepared in advance, such as Talk about the width and height information of characters; if you want to use it to read from the font library, it is very time-consuming; another example: every time a character is drawn, it reads the relevant information through the file system to the font library; and through the file It is very slow for the system to read character information; greatly reducing efficiency.

发明内容Contents of the invention

本发明实施例的目的在于提出一种显示字符的方法及装置,旨在解决如何提高矢量字体的显示速度的问题。The purpose of the embodiments of the present invention is to provide a method and device for displaying characters, aiming at solving the problem of how to improve the display speed of vector fonts.

为达此目的,本发明实施例采用以下技术方案:To achieve this purpose, the embodiments of the present invention adopt the following technical solutions:

一种显示字符的方法,所述方法包括:A method of displaying characters, the method comprising:

获取待显示字符的编码信息,所述编码信息包括Unicode编码;Obtain encoding information of characters to be displayed, where the encoding information includes Unicode encoding;

根据所述编码信息确定所述待显示字符是否在预先存储的编码信息中;determining whether the character to be displayed is in pre-stored encoding information according to the encoding information;

若是,则直接从预先存储的编码信息中获取所述待显示字符的轮廓信息,根据所述轮廓信息绘制字符图形并显示所述待显示字符。If so, directly obtain the outline information of the character to be displayed from the pre-stored coding information, draw a character graphic according to the outline information, and display the character to be displayed.

优选地,所述根据所述编码信息确定所述待显示字符是否在预先存储的编码信息中,包括:Preferably, the determining whether the character to be displayed is in the pre-stored encoding information according to the encoding information includes:

根据所述待显示字符的Unicode编码,确定所述待显示字符的Unicode编码是否在预先存储的Unicode编码中,且所述待显示字符的字号是否在预先存储的字号范围内。According to the Unicode encoding of the character to be displayed, it is determined whether the Unicode encoding of the character to be displayed is in the pre-stored Unicode encoding, and whether the font size of the character to be displayed is within the range of the pre-stored font size.

优选地,所述直接从预先存储的编码信息中获取所述待显示字符的轮廓信息,根据所述轮廓信息绘制字符图形并显示所述待显示字符,包括:Preferably, the directly obtaining the outline information of the character to be displayed from the pre-stored coding information, drawing a character graphic according to the outline information and displaying the character to be displayed includes:

若确定所述待显示字符的Unicode编码在预先存储的Unicode编码中,且所述待显示字符的字号也在预先存储的字号范围内,则通过GDI绘制字符图形,并显示所述待显示字符。If it is determined that the Unicode code of the character to be displayed is in the pre-stored Unicode code, and the font size of the character to be displayed is also within the range of the font size stored in advance, drawing a character graphic through GDI and displaying the character to be displayed.

优选地,所述方法在获取待显示字符的编码信息之前或者之后,还包括:Preferably, before or after obtaining the encoding information of the characters to be displayed, the method further includes:

预先存储常用字符的Unicode编码以及常用字符的轮廓信息。Pre-store the Unicode encoding of commonly used characters and the outline information of commonly used characters.

优选地,所述方法还包括:Preferably, the method also includes:

预先存储字库的宽度信息。The width information of the font is stored in advance.

一种显示字符的装置,所述装置包括:A device for displaying characters, the device comprising:

获取模块,用于获取待显示字符的编码信息,所述编码信息包括Unicode编码;An acquisition module, configured to acquire encoding information of characters to be displayed, where the encoding information includes Unicode encoding;

确定模块,用于根据所述编码信息确定所述待显示字符是否在预先存储的编码信息中;A determination module, configured to determine whether the character to be displayed is in the pre-stored encoding information according to the encoding information;

显示模块,用于若是,则直接从预先存储的编码信息中获取所述待显示字符的轮廓信息,根据所述轮廓信息绘制字符图形并显示所述待显示字符。The display module is configured to directly obtain the outline information of the character to be displayed from the pre-stored coding information, draw a character graphic according to the outline information, and display the character to be displayed if so.

优选地,所述确定模块,包括:Preferably, the determination module includes:

确定单元,用于根据所述待显示字符的Unicode编码,确定所述待显示字符的Unicode编码是否在预先存储的Unicode编码中,且所述待显示字符的字号是否在预先存储的字号范围内。The determining unit is configured to determine whether the Unicode encoding of the character to be displayed is in the pre-stored Unicode encoding and whether the font size of the character to be displayed is within the range of the pre-stored font size according to the Unicode encoding of the character to be displayed.

优选地,所述显示模块,包括:Preferably, the display module includes:

显示单元,用于若确定所述待显示字符的Unicode编码在预先存储的Unicode编码中,且所述待显示字符的字号也在预先存储的字号范围内,则通过GDI绘制字符图形,并显示所述待显示字符。The display unit is used to draw a character graphic through GDI and display the Unicode code of the character to be displayed if it is determined that the Unicode code of the character to be displayed is in the pre-stored Unicode code, and the font size of the character to be displayed is also within the range of the font size stored in advance. Describes the characters to be displayed.

优选地,所述装置还包括:Preferably, the device also includes:

第一存储模块,用于预先存储常用字符的Unicode编码以及常用字符的轮廓信息。The first storage module is used for pre-storing Unicode codes of common characters and outline information of common characters.

优选地,所述装置还包括:Preferably, the device also includes:

第二存储模块,用于预先存储字库的宽度信息。The second storage module is used for pre-storing the width information of the font.

本发明实施例通过获取待显示字符的编码信息,所述编码信息包括Unicode编码;根据所述编码信息确定所述待显示字符是否在预先存储的编码信息中;若是,则直接从预先存储的编码信息中获取所述待显示字符的轮廓信息,根据所述轮廓信息绘制字符图形并显示所述待显示字符,从而全面提高矢量字体的显示速度,有效提高系统运行速度,提高用户体验;并能节省系统资源,有效省电,提供更长的续航能力。In the embodiment of the present invention, by acquiring the encoding information of the character to be displayed, the encoding information includes Unicode encoding; determining whether the character to be displayed is in the pre-stored encoding information according to the encoding information; if so, directly from the pre-stored encoding Obtain the outline information of the character to be displayed in the information, draw character graphics according to the outline information and display the character to be displayed, thereby comprehensively improving the display speed of the vector font, effectively improving the system operating speed, and improving user experience; and saving System resources, effectively saving power and providing longer battery life.

附图说明Description of drawings

图1是本发明实施例显示字符的方法第一实施例的流程示意图;FIG. 1 is a schematic flowchart of a first embodiment of a method for displaying characters in an embodiment of the present invention;

图2是本发明实施例显示字符的方法第二实施例的流程示意图;FIG. 2 is a schematic flowchart of a second embodiment of a method for displaying characters according to an embodiment of the present invention;

图3是本发明实施例显示字符的方法第三实施例的流程示意图;FIG. 3 is a schematic flowchart of a third embodiment of a method for displaying characters according to an embodiment of the present invention;

图4是本发明实施例显示字符的装置的功能模块示意图;4 is a schematic diagram of functional modules of a device for displaying characters according to an embodiment of the present invention;

图5是本发明实施例确定模块的功能模块示意图;Fig. 5 is a schematic diagram of functional modules of a determination module according to an embodiment of the present invention;

图6是本发明实施例显示模块的功能模块示意图;6 is a schematic diagram of functional modules of a display module according to an embodiment of the present invention;

图7是本发明实施例显示字符的装置的功能模块示意图;7 is a schematic diagram of functional modules of a device for displaying characters according to an embodiment of the present invention;

图8是本发明实施例显示字符的装置的功能模块示意图。Fig. 8 is a schematic diagram of functional modules of the device for displaying characters according to an embodiment of the present invention.

具体实施方式Detailed ways

下面结合附图和实施例对本发明实施例作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释本发明实施例,而非对本发明实施例的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与本发明实施例相关的部分而非全部结构。The embodiments of the present invention will be further described in detail below in conjunction with the drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the embodiments of the present invention, rather than to limit the embodiments of the present invention. In addition, it should be noted that, for the convenience of description, the drawings only show some but not all structures related to the embodiments of the present invention.

实施例一Embodiment one

参考图,图1是本发明实施例显示字符的方法第一实施例的流程示意图。Referring to the drawings, FIG. 1 is a schematic flowchart of a first embodiment of a method for displaying characters according to an embodiment of the present invention.

在实施例一中,所述显示字符的方法包括:In Embodiment 1, the method for displaying characters includes:

步骤101,获取待显示字符的编码信息,所述编码信息包括Unicode编码;Step 101, acquiring encoding information of characters to be displayed, said encoding information including Unicode encoding;

步骤102,根据所述编码信息确定所述待显示字符是否在预先存储的编码信息中;Step 102, determining whether the character to be displayed is in the pre-stored encoding information according to the encoding information;

优选地,所述根据所述编码信息确定所述待显示字符是否在预先存储的编码信息中,包括:Preferably, the determining whether the character to be displayed is in the pre-stored encoding information according to the encoding information includes:

根据所述待显示字符的Unicode编码,确定所述待显示字符的Unicode编码是否在预先存储的Unicode编码中,且所述待显示字符的字号是否在预先存储的字号范围内。According to the Unicode encoding of the character to be displayed, it is determined whether the Unicode encoding of the character to be displayed is in the pre-stored Unicode encoding, and whether the font size of the character to be displayed is within the range of the pre-stored font size.

具体的,在很多嵌入式设备中,比如是学习机、词典机中,有很多的生僻字和字造字要显示,制作一个比较完整的字库大概有四五万个汉字或者字符,导致整个字库文件很大,一般在15M以上;由于系统的内存大小限制,字库文件不能一次性加载到内存中,传统做法是读取的方式来获取汉字或者字符轮廓信息再计算出字模来显示汉字。如果我们通过PC端的工具把常用汉字和常用符号的轮廓信息提取出来保存文件的形式,在系统加载的时候把本文件一次性加载到内存中,直接操作内存比读取字库文件要快很多倍。比如把常用汉字GBK2312编码和常用符号(一共7000个左右)的轮廓信息提取出来,保存文件大小大概是1.6M,在内存中,所述常用汉字GBK2312编码的存储形式是以Unicode编码的形式存储的,对于每一个汉字的GBK2312编码,均有一个Unicode编码与之对应。Specifically, in many embedded devices, such as learning machines and dictionary machines, there are a lot of uncommon characters and characters to be displayed. Making a relatively complete font library has about 40,000 to 50,000 Chinese characters or characters, resulting in the entire font library The file is very large, generally more than 15M; due to the limitation of the memory size of the system, the font file cannot be loaded into the memory at one time. The traditional method is to read to obtain Chinese characters or character outline information and then calculate the font to display Chinese characters. If we use PC-side tools to extract the outline information of commonly used Chinese characters and common symbols to save the file, and load this file into the memory at one time when the system is loaded, directly operating the memory is many times faster than reading font files. For example, extract the outline information of commonly used Chinese characters GBK2312 codes and common symbols (about 7000 in total), and the saved file size is about 1.6M. In the memory, the storage form of the commonly used Chinese characters GBK2312 codes is stored in the form of Unicode codes , for the GBK2312 encoding of each Chinese character, there is a Unicode encoding corresponding to it.

具体的,如果是显示的内容大部分是英文字符的话,即使通过上面第二点进行了优化,但是感觉还是有点慢,比如在这种情况下(看英文电子书、或者英文词典):屏幕比较大,字号比较小,而且显示的字符大部分是英文字符或者全是,一屏显示的字符数达到上千个;即使计算出单个字模很快,但是显示字符多了,累加起来显示时间就变长了,这里主要是消耗根据字符轮廓信息计算出字模的时间。如果我们通过PC端的工具把英文字符的大小写和常用符号大概在128个左右(ASCII编码),主要把字号较小的英文字符或者符号通过轮廓信息计算出字模信息保存到一个文件,大概是2M,在系统加载的时候把本文件一次性加载到内存中,在这种情况下,就不用去读字库的轮廓信息,也不要去计算字模了,相等于是点阵字体了,显示速度较快。Specifically, if most of the displayed content is English characters, even if it is optimized through the second point above, it still feels a bit slow. For example, in this case (reading English e-books or English dictionaries): screen comparison Large, the font size is relatively small, and most of the characters displayed are English characters or all of them, and the number of characters displayed on one screen reaches thousands; even if the calculation of a single font is fast, but there are too many characters to display, the cumulative display time will change. It's long, here is mainly to consume the time to calculate the font based on the character outline information. If we use the tools on the PC side to set the uppercase and lowercase characters and common symbols of English characters to about 128 (ASCII encoding), mainly save the font information of English characters or symbols with smaller font sizes to a file calculated from the outline information, which is about 2M , when the system is loaded, load this file into the memory at one time. In this case, there is no need to read the outline information of the font, and do not need to calculate the font. It is equivalent to a dot matrix font, and the display speed is faster.

步骤103,若是,则直接从预先存储的编码信息中获取所述待显示字符的轮廓信息,根据所述轮廓信息绘制字符图形并显示所述待显示字符。Step 103, if yes, obtain the outline information of the character to be displayed directly from the pre-stored coding information, draw a character graphic according to the outline information, and display the character to be displayed.

优选地,所述直接从预先存储的编码信息中获取所述待显示字符的轮廓信息,根据所述轮廓信息绘制字符图形并显示所述待显示字符,包括:Preferably, the directly obtaining the outline information of the character to be displayed from the pre-stored coding information, drawing a character graphic according to the outline information and displaying the character to be displayed includes:

若确定所述待显示字符的Unicode编码在预先存储的Unicode编码中,且所述待显示字符的字号也在预先存储的字号范围内,则通过GDI绘制字符图形,并显示所述待显示字符。If it is determined that the Unicode code of the character to be displayed is in the pre-stored Unicode code, and the font size of the character to be displayed is also within the range of the font size stored in advance, drawing a character graphic through GDI and displaying the character to be displayed.

具体的,a、把字符宽高信息提取保存文件形式,在系统启动的时候一次性加载到内存,可以少获取一次字库信息。Specifically, a. The character width and height information is extracted and stored as a file, and loaded into the memory at one time when the system is started, so that the font information can be obtained less once.

b、把常用字符比如GBK2312字符集的轮廓信息提取保存文件形式,在系统启动的时候一次性加载到内存,避免读取字库信息了,在文件系统读取文件是很慢的,所以对提高速度有非常大帮助。b. Extract the outline information of commonly used characters such as GBK2312 character set and save it as a file, and load it into the memory at one time when the system starts to avoid reading font information. Reading files in the file system is very slow, so it is necessary to improve the speed There is very big help.

c、把英文字符和常用符号转换成点阵字体,保存文件形式,在系统启动的时候一次性加载到内存,不同通过大量的数学计算就可以显示字体了,显示速度与点阵字体相当。c. Convert English characters and common symbols into dot-matrix fonts, save the file format, and load it into the memory at one time when the system is started. The fonts can be displayed through a large number of mathematical calculations, and the display speed is comparable to that of dot-matrix fonts.

本发明实施例通过获取待显示字符的编码信息,所述编码信息包括Unicode编码;根据所述编码信息确定所述待显示字符是否在预先存储的编码信息中;若是,则直接从预先存储的编码信息中获取所述待显示字符的轮廓信息,根据所述轮廓信息绘制字符图形并显示所述待显示字符,从而全面提高矢量字体的显示速度,有效提高系统运行速度,提高用户体验;并能节省系统资源,有效省电,提供更长的续航能力。In the embodiment of the present invention, by acquiring the encoding information of the character to be displayed, the encoding information includes Unicode encoding; determining whether the character to be displayed is in the pre-stored encoding information according to the encoding information; if so, directly from the pre-stored encoding Obtain the outline information of the character to be displayed in the information, draw character graphics according to the outline information and display the character to be displayed, thereby comprehensively improving the display speed of the vector font, effectively improving the system operating speed, and improving user experience; and saving System resources, effectively saving power and providing longer battery life.

实施例二Embodiment two

参考图2,图2是本发明实施例显示字符的方法第二实施例的流程示意图。Referring to FIG. 2 , FIG. 2 is a schematic flowchart of a second embodiment of a method for displaying characters according to an embodiment of the present invention.

在实施例一的基础上,所述显示字符的方法在获取待显示字符的编码信息之前或者之后,还包括:On the basis of Embodiment 1, before or after obtaining the encoding information of the characters to be displayed, the method for displaying characters further includes:

步骤104,预先存储常用字符的Unicode编码以及常用字符的轮廓信息。Step 104, pre-store the Unicode codes of common characters and the outline information of common characters.

实施例三Embodiment three

参考图3,图3是本发明实施例显示字符的方法第三实施例的流程示意图。Referring to FIG. 3 , FIG. 3 is a schematic flowchart of a third embodiment of a method for displaying characters according to an embodiment of the present invention.

在实施例一的基础上,所述显示字符的方法还包括:On the basis of Embodiment 1, the method for displaying characters further includes:

步骤105,预先存储字库的宽度信息。Step 105, pre-store width information of fonts.

具体的,在显示汉字或者字符的时候,都需要获取每一个汉字或者字符的宽度信息进行预排版,比如说电子书之类的,每次打开显示是当前页,但是这个时候后台在快速的获取字体宽度信息进行预版本,才能得到当前是第几页,一共有多少页,只有这样才实现快速翻页。而传统的做法都是根据汉字或者字符的Unicode编码从字库里面计算得到宽度信息,这样又要计算,又得从字库里面读取信息,就太慢了,关是文件的读取速度就特别慢了。所以通过PC端的处理工具实现提取字库的的宽度信息保存到一个文件,为了尽量减小文件大小,可以根据需求提取主要宽度信息,比如说12号字体到48号字体的偶数,这样既全面又通用了。在系统加载的时候,就把这个宽度信息文件加载到内存中,每次需要宽度信息就可以直接读取内存,速度得到大幅提升。Specifically, when displaying Chinese characters or characters, it is necessary to obtain the width information of each Chinese character or character for pre-typesetting. For example, e-books and the like, the current page is displayed every time it is opened, but at this time the background is quickly obtaining Only by pre-versioning the font width information can we get the current page number and how many pages there are in total. Only in this way can we realize fast page turning. The traditional method is to calculate the width information from the font library based on the Unicode encoding of Chinese characters or characters. In this way, it is too slow to calculate and read information from the font library. The reason is that the reading speed of the file is very slow. up. Therefore, through the processing tool on the PC side, the width information of the font library can be extracted and saved to a file. In order to minimize the file size, the main width information can be extracted according to the needs, such as even numbers from font size 12 to font size 48, which is comprehensive and universal. up. When the system is loaded, the width information file is loaded into the memory, and the memory can be directly read every time the width information is needed, and the speed is greatly improved.

实施例四Embodiment four

参考图4,图4是本发明实施例显示字符的装置的功能模块示意图。Referring to FIG. 4 , FIG. 4 is a schematic diagram of functional modules of an apparatus for displaying characters according to an embodiment of the present invention.

在实施例四中,所述显示字符的装置包括:In Embodiment 4, the device for displaying characters includes:

获取模块401,用于获取待显示字符的编码信息,所述编码信息包括Unicode编码;An acquisition module 401, configured to acquire encoding information of characters to be displayed, where the encoding information includes Unicode encoding;

确定模块402,用于根据所述编码信息确定所述待显示字符是否在预先存储的编码信息中;A determination module 402, configured to determine whether the character to be displayed is in the pre-stored encoding information according to the encoding information;

优选地,参考图5,图5是本发明实施例确定模块402的功能模块示意图。所述确定模块402,包括:Preferably, refer to FIG. 5 , which is a schematic diagram of functional modules of the determination module 402 according to the embodiment of the present invention. The determining module 402 includes:

确定单元501,用于根据所述待显示字符的Unicode编码,确定所述待显示字符的Unicode编码是否在预先存储的Unicode编码中,且所述待显示字符的字号是否在预先存储的字号范围内。The determining unit 501 is configured to determine whether the Unicode encoding of the character to be displayed is in the pre-stored Unicode encoding and whether the font size of the character to be displayed is within the pre-stored font size range according to the Unicode encoding of the character to be displayed .

具体的,在很多嵌入式设备中,比如是学习机、词典机中,有很多的生僻字和字造字要显示,制作一个比较完整的字库大概有四五万个汉字或者字符,导致整个字库文件很大,一般在15M以上;由于系统的内存大小限制,字库文件不能一次性加载到内存中,传统做法是读取的方式来获取汉字或者字符轮廓信息再计算出字模来显示汉字。如果我们通过PC端的工具把常用汉字和常用符号的轮廓信息提取出来保存文件的形式,在系统加载的时候把本文件一次性加载到内存中,直接操作内存比读取字库文件要快很多倍。比如把常用汉字GBK2312编码和常用符号(一共7000个左右)的轮廓信息提取出来,保存文件大小大概是1.6M。Specifically, in many embedded devices, such as learning machines and dictionary machines, there are a lot of uncommon characters and characters to be displayed. Making a relatively complete font library has about 40,000 to 50,000 Chinese characters or characters, resulting in the entire font library The file is very large, generally more than 15M; due to the limitation of the memory size of the system, the font file cannot be loaded into the memory at one time. The traditional method is to read to obtain Chinese characters or character outline information and then calculate the font to display Chinese characters. If we use PC-side tools to extract the outline information of commonly used Chinese characters and common symbols to save the file, and load this file into the memory at one time when the system is loaded, directly operating the memory is many times faster than reading font files. For example, the outline information of commonly used Chinese characters GBK2312 encoding and commonly used symbols (about 7000 in total) is extracted, and the saved file size is about 1.6M.

具体的,如果是显示的内容大部分是英文字符的话,即使通过上面第二点进行了优化,但是感觉还是有点慢,比如在这种情况下(看英文电子书、或者英文词典):屏幕比较大,字号比较小,而且显示的字符大部分是英文字符或者全是,一屏显示的字符数达到上千个;即使计算出单个字模很快,但是显示字符多了,累加起来显示时间就变长了,这里主要是消耗根据字符轮廓信息计算出字模的时间。如果我们通过PC端的工具把英文字符的大小写和常用符号大概在128个左右(ASCII编码),主要把字号较小的英文字符或者符号通过轮廓信息计算出字模信息保存到一个文件,大概是2M,在系统加载的时候把本文件一次性加载到内存中,在这种情况下,就不用去读字库的轮廓信息,也不要去计算字模了,相等于是点阵字体了,显示速度较快。Specifically, if most of the displayed content is English characters, even if it is optimized through the second point above, it still feels a bit slow. For example, in this case (reading English e-books or English dictionaries): screen comparison Large, the font size is relatively small, and most of the characters displayed are English characters or all of them, and the number of characters displayed on one screen reaches thousands; even if the calculation of a single font is fast, but there are too many characters to display, the cumulative display time will change. It's long, here is mainly to consume the time to calculate the font based on the character outline information. If we use the tools on the PC side to set the uppercase and lowercase characters and common symbols of English characters to about 128 (ASCII encoding), mainly save the font information of English characters or symbols with smaller font sizes to a file calculated from the outline information, which is about 2M , when the system is loaded, load this file into the memory at one time. In this case, there is no need to read the outline information of the font, and do not need to calculate the font. It is equivalent to a dot matrix font, and the display speed is faster.

显示模块403,用于若是,则直接从预先存储的编码信息中获取所述待显示字符的轮廓信息,根据所述轮廓信息绘制字符图形并显示所述待显示字符。The display module 403 is configured to, if yes, obtain the outline information of the character to be displayed directly from the pre-stored coding information, draw a character graphic according to the outline information, and display the character to be displayed.

优选地,参考图6,图6是本发明实施例显示模块403的功能模块示意图。所述显示模块403,包括:Preferably, refer to FIG. 6 , which is a schematic diagram of functional modules of the display module 403 according to an embodiment of the present invention. The display module 403 includes:

显示单元601,用于若确定所述待显示字符的Unicode编码在预先存储的Unicode编码中,且所述待显示字符的字号也在预先存储的字号范围内,则通过GDI绘制字符图形,并显示所述待显示字符。The display unit 601 is configured to draw a character graphic through GDI if it is determined that the Unicode encoding of the character to be displayed is in the pre-stored Unicode encoding, and the font size of the character to be displayed is also within the range of the pre-stored font size, and display The character to be displayed.

具体的,a、把字符宽高信息提取保存文件形式,在系统启动的时候一次性加载到内存,可以少获取一次字库信息。Specifically, a. The character width and height information is extracted and stored as a file, and loaded into the memory at one time when the system is started, so that the font information can be obtained less once.

b、把常用字符比如GBK2312字符集的轮廓信息提取保存文件形式,在系统启动的时候一次性加载到内存,避免读取字库信息了,在文件系统读取文件是很慢的,所以对提高速度有非常大帮助。b. Extract the outline information of commonly used characters such as GBK2312 character set and save it as a file, and load it into the memory at one time when the system starts to avoid reading font information. Reading files in the file system is very slow, so it is necessary to improve the speed There is very big help.

c、把英文字符和常用符号转换成点阵字体,保存文件形式,在系统启动的时候一次性加载到内存,不同通过大量的数学计算就可以显示字体了,显示速度与点阵字体相当。c. Convert English characters and common symbols into dot-matrix fonts, save the file format, and load it into the memory at one time when the system is started. The fonts can be displayed through a large number of mathematical calculations, and the display speed is comparable to that of dot-matrix fonts.

本发明实施例通过获取待显示字符的编码信息,所述编码信息包括Unicode编码;根据所述编码信息确定所述待显示字符是否在预先存储的编码信息中;若是,则直接从预先存储的编码信息中获取所述待显示字符的轮廓信息,根据所述轮廓信息绘制字符图形并显示所述待显示字符,从而全面提高矢量字体的显示速度,有效提高系统运行速度,提高用户体验;并能节省系统资源,有效省电,提供更长的续航能力。In the embodiment of the present invention, by acquiring the encoding information of the character to be displayed, the encoding information includes Unicode encoding; determining whether the character to be displayed is in the pre-stored encoding information according to the encoding information; if so, directly from the pre-stored encoding Obtain the outline information of the character to be displayed in the information, draw character graphics according to the outline information and display the character to be displayed, thereby comprehensively improving the display speed of the vector font, effectively improving the system operating speed, and improving user experience; and saving System resources, effectively saving power and providing longer battery life.

实施例五Embodiment five

参考图7,图7是本发明实施例显示字符的装置的功能模块示意图。Referring to FIG. 7 , FIG. 7 is a schematic diagram of functional modules of an apparatus for displaying characters according to an embodiment of the present invention.

在实施例四的基础上,所述方法还包括:On the basis of embodiment four, the method also includes:

第一存储模块404,用于预先存储常用字符的Unicode编码以及常用字符的轮廓信息。The first storage module 404 is used for pre-storing Unicode codes of common characters and outline information of common characters.

实施例六Embodiment six

参考图8,图8是本发明实施例显示字符的装置的功能模块示意图。Referring to FIG. 8 , FIG. 8 is a schematic diagram of functional modules of an apparatus for displaying characters according to an embodiment of the present invention.

在实施例四的基础上,所述方法还包括:On the basis of embodiment four, the method also includes:

第二存储模块405,用于预先存储字库的宽度信息。The second storage module 405 is used for storing the width information of the font in advance.

具体的,在显示汉字或者字符的时候,都需要获取每一个汉字或者字符的宽度信息进行预排版,比如说电子书之类的,每次打开显示是当前页,但是这个时候后台在快速的获取字体宽度信息进行预版本,才能得到当前是第几页,一共有多少页,只有这样才实现快速翻页。而传统的做法都是根据汉字或者字符的Unicode编码从字库里面计算得到宽度信息,这样又要计算,又得从字库里面读取信息,就太慢了,关是文件的读取速度就特别慢了。所以通过PC端的处理工具实现提取字库的的宽度信息保存到一个文件,为了尽量减小文件大小,可以根据需求提取主要宽度信息,比如说12号字体到48号字体的偶数,这样既全面又通用了。在系统加载的时候,就把这个宽度信息文件加载到内存中,每次需要宽度信息就可以直接读取内存,速度得到大幅提升。Specifically, when displaying Chinese characters or characters, it is necessary to obtain the width information of each Chinese character or character for pre-typesetting. For example, e-books and the like, the current page is displayed every time it is opened, but at this time the background is quickly obtaining Only by pre-versioning the font width information can we get the current page number and how many pages there are in total. Only in this way can we realize fast page turning. The traditional method is to calculate the width information from the font library based on the Unicode encoding of Chinese characters or characters. In this way, it is too slow to calculate and read information from the font library. The reason is that the reading speed of the file is very slow. up. Therefore, through the processing tool on the PC side, the width information of the font library can be extracted and saved to a file. In order to minimize the file size, the main width information can be extracted according to the needs, such as even numbers from font size 12 to font size 48, which is comprehensive and universal. up. When the system is loaded, the width information file is loaded into the memory, and the memory can be directly read every time the width information is needed, and the speed is greatly improved.

以上结合具体实施例描述了本发明实施例的技术原理。这些描述只是为了解释本发明实施例的原理,而不能以任何方式解释为对本发明实施例保护范围的限制。基于此处的解释,本领域的技术人员不需要付出创造性的劳动即可联想到本发明实施例的其它具体实施方式,这些方式都将落入本发明实施例的保护范围之内。The above describes the technical principles of the embodiments of the present invention in conjunction with specific embodiments. These descriptions are only for explaining the principles of the embodiments of the present invention, and cannot be construed as limiting the protection scope of the embodiments of the present invention in any way. Based on the explanations herein, those skilled in the art can think of other specific implementation manners of the embodiments of the present invention without creative work, and these manners will fall within the protection scope of the embodiments of the present invention.

Claims (10)

1. show a method for character, it is characterized in that, described method comprises:
Obtain the coded message of character to be shown, described coded message comprises Unicode coding;
Described character to be shown is determined whether in the coded message prestored according to described coded message;
If so, then obtaining the profile information of described character to be shown the direct coded message from prestoring, drawing character graphics according to described profile information and showing described character to be shown.
2. method according to claim 1, is characterized in that, describedly determines described character to be shown whether in the coded message prestored according to described coded message, comprising:
Unicode according to described character to be shown encodes, and determines that the Unicode coding of described character to be shown is whether in the Unicode coding prestored, and whether the font size of described character to be shown is in the size range prestored.
3. method according to claim 1, is characterized in that, the described profile information directly obtaining described character to be shown from the coded message prestored, and draws character graphics and shows described character to be shown, comprising according to described profile information:
If determine, the Unicode of described character to be shown is coded in the Unicode coding prestored, and the font size of described character to be shown is also in the size range prestored, then draw character graphics by GDI, and shows described character to be shown.
4. the method according to claims 1 to 3 any one, is characterized in that, described method obtain character to be shown coded message before or afterwards, also comprise:
Prestore the Unicode coding of conventional characters and the profile information of conventional characters.
5. the method according to claims 1 to 3 any one, is characterized in that, described method also comprises:
Prestore the width information of character library.
6. show a device for character, it is characterized in that, described device comprises:
Acquisition module, for obtaining the coded message of character to be shown, described coded message comprises Unicode coding;
Determination module, for determining described character to be shown whether in the coded message prestored according to described coded message;
Display module, for if so, then obtaining the profile information of described character to be shown the direct coded message from prestoring, drawing character graphics according to described profile information and showing described character to be shown.
7. device according to claim 6, is characterized in that, described determination module, comprising:
Determining unit, encodes for the Unicode according to described character to be shown, determines that the Unicode coding of described character to be shown is whether in the Unicode coding prestored, and whether the font size of described character to be shown is in the size range prestored.
8. device according to claim 6, is characterized in that, described display module, comprising:
Display unit, if for determining that the Unicode of described character to be shown is coded in the Unicode coding prestored, and the font size of described character to be shown is also in the size range prestored, then draw character graphics by GDI, and show described character to be shown.
9. the device according to claim 6 to 8 any one, is characterized in that, described device also comprises:
First memory module, for prestoring Unicode coding and the profile information of conventional characters of conventional characters.
10. the device according to claim 6 to 8 any one, is characterized in that, described method also comprises:
Second memory module, for prestoring the width information of character library.
CN201510473668.2A 2015-08-05 2015-08-05 Method and device for displaying characters Pending CN105047181A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510473668.2A CN105047181A (en) 2015-08-05 2015-08-05 Method and device for displaying characters

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510473668.2A CN105047181A (en) 2015-08-05 2015-08-05 Method and device for displaying characters

Publications (1)

Publication Number Publication Date
CN105047181A true CN105047181A (en) 2015-11-11

Family

ID=54453671

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510473668.2A Pending CN105047181A (en) 2015-08-05 2015-08-05 Method and device for displaying characters

Country Status (1)

Country Link
CN (1) CN105047181A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106249910A (en) * 2016-07-15 2016-12-21 广东小天才科技有限公司 Character processing method and device based on word stock and user terminal
CN112069770A (en) * 2020-09-17 2020-12-11 中国航空无线电电子研究所 Improved font generation method based on Vaps XT

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0919907A1 (en) * 1997-11-25 1999-06-02 Sharp Kabushiki Kaisha Scroll controller
CN101316339A (en) * 2008-06-13 2008-12-03 深圳创维-Rgb电子有限公司 Method of displaying different expressions of characters in the same font
CN101324960A (en) * 2007-06-14 2008-12-17 株式会社理光 Signal display device, printer and signal display method
CN101873451A (en) * 2010-05-19 2010-10-27 杭州海康威视数字技术股份有限公司 Method and device for realizing on-screen display (OSD) of characters
CN102723067A (en) * 2012-06-01 2012-10-10 中国科学院声学研究所 Character display method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0919907A1 (en) * 1997-11-25 1999-06-02 Sharp Kabushiki Kaisha Scroll controller
CN101324960A (en) * 2007-06-14 2008-12-17 株式会社理光 Signal display device, printer and signal display method
CN101316339A (en) * 2008-06-13 2008-12-03 深圳创维-Rgb电子有限公司 Method of displaying different expressions of characters in the same font
CN101873451A (en) * 2010-05-19 2010-10-27 杭州海康威视数字技术股份有限公司 Method and device for realizing on-screen display (OSD) of characters
CN102723067A (en) * 2012-06-01 2012-10-10 中国科学院声学研究所 Character display method and device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106249910A (en) * 2016-07-15 2016-12-21 广东小天才科技有限公司 Character processing method and device based on word stock and user terminal
CN106249910B (en) * 2016-07-15 2019-01-04 广东小天才科技有限公司 Character processing method and device based on word stock and user terminal
CN112069770A (en) * 2020-09-17 2020-12-11 中国航空无线电电子研究所 Improved font generation method based on Vaps XT
CN112069770B (en) * 2020-09-17 2024-04-12 中国航空无线电电子研究所 Improved font generation method based on Vaps XT

Similar Documents

Publication Publication Date Title
US7505041B2 (en) Iteratively solving constraints in a font-hinting language
US9881395B2 (en) Rendering multi-part glyphs
CN101467140B (en) Remote control to distinguish sub-pixel characters
CN107562480B (en) Method and system for realizing multilingual of POS machine
KR20090075693A (en) Rendering and Encoding Glyphs
CN110235176A (en) Processing method and processing device, data transmission method and device, the storage medium of image
EP2784771A1 (en) Display apparatus and method of outputting text thereof
CN102479075A (en) Multi-language display method and device in embedded equipment
JP2003044035A (en) Irreversible compression and storage method for font
CN100573655C (en) The layout that is used for scaling of fonts
US20070013700A1 (en) Mobile communication terminal having function of animating input characters
JP2014038301A (en) Method for operating character string in an integrated system
CN105047181A (en) Method and device for displaying characters
US9081529B1 (en) Generation of electronic books
JP4905899B2 (en) Information processing system, information processing program, and readable recording medium
CN102768655B (en) JAVA-based display method of Mongolian
US11132497B2 (en) Device and method for inputting characters
CN110164399B (en) 8-bit depth type matrix storage optimization method
CN103559271A (en) Method for generating bitmap font library with gray level
US9905030B2 (en) Image processing device, image processing method, information storage medium, and program
KR102471306B1 (en) Device and method for inputting characters
KR101204615B1 (en) Method for creating individual font and mobile device using thereof
JP2015011420A (en) Article image reconstruction device
CN113076715B (en) Method and system for creating text blocks in Allegro
KR100522797B1 (en) Apparatus and method for translating simbol code of arabic

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20151111