[go: up one dir, main page]

CN105224509A - A kind of method and device generating font format - Google Patents

A kind of method and device generating font format Download PDF

Info

Publication number
CN105224509A
CN105224509A CN201410241118.3A CN201410241118A CN105224509A CN 105224509 A CN105224509 A CN 105224509A CN 201410241118 A CN201410241118 A CN 201410241118A CN 105224509 A CN105224509 A CN 105224509A
Authority
CN
China
Prior art keywords
font
format
file
type
font format
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
CN201410241118.3A
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.)
FOUNDER DIGITAL PUBLISHING TECHNOLOGY (SHANGHAI) CO LTD
Peking University Founder Information Industry Group Co Ltd
Peking University Founder Group Co Ltd
Original Assignee
FOUNDER DIGITAL PUBLISHING TECHNOLOGY (SHANGHAI) CO LTD
Peking University Founder Information Industry Group Co Ltd
Peking University Founder Group 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 FOUNDER DIGITAL PUBLISHING TECHNOLOGY (SHANGHAI) CO LTD, Peking University Founder Information Industry Group Co Ltd, Peking University Founder Group Co Ltd filed Critical FOUNDER DIGITAL PUBLISHING TECHNOLOGY (SHANGHAI) CO LTD
Priority to CN201410241118.3A priority Critical patent/CN105224509A/en
Publication of CN105224509A publication Critical patent/CN105224509A/en
Pending legal-status Critical Current

Links

Landscapes

  • Document Processing Apparatus (AREA)

Abstract

本发明提供了一种生成字体格式的方法及装置。所述方法,应用于一服务器,包括:接收终端应用程序传输的字体类型以及文字内容对应的Unicode编码;根据所述字体类型和所述Unicode编码,得到所述字体类型的字体文件中与所述文字内容对应的字体格式集合;将所述字体格式集合封装成所述应用程序可使用的包含字体数据的文件后,发送给所述终端应用程序。上述方案,通过在服务器端将字体格式封装成可以为应用程序所识别的文件,提供给应用程序使用,其生成速度快,数据量小,能有效的保持字体的原始效果,在任意缩放比例下都能完整呈现字体的全部内容,极大地提高了用户的使用体验。

The invention provides a method and device for generating a font format. The method, applied to a server, includes: receiving the font type transmitted by the terminal application program and the Unicode code corresponding to the text content; according to the font type and the Unicode code, obtaining the font file of the font type corresponding to the A font format set corresponding to the text content; after the font format set is packaged into a file containing font data usable by the application program, it is sent to the terminal application program. The above solution encapsulates the font format on the server side into a file that can be recognized by the application program and provides it to the application program. The generation speed is fast, the data volume is small, and the original effect of the font can be effectively maintained. All content of the font can be completely presented, which greatly improves the user experience.

Description

一种生成字体格式的方法及装置Method and device for generating font format

技术领域technical field

本发明涉及文字处理领域,特别涉及一种生成字体格式的方法及装置。The invention relates to the field of word processing, in particular to a method and device for generating font formats.

背景技术Background technique

随着科技的发展和互联网的普及,大量的个性化印品陆续出现,如:个性定制相册、明信片、照片书等;同时大量的在线定制个性化印品的网站也纷纷出现。国外的如Shutterfly、MixBook、Blurb等,国内如网易印象派、我的相册网等。通常,对于欧美的相关产品,由于英语国家的字母相对较少,常用字符只有100多个,字体的存储容量相对较小;因此其对字体的处理使用下载全量的字体数据到本地的方式。但由于中文字体的特点,即使是比较小的文字集合,国标GB2312也包含有6000个以上的字形,字体文件的尺寸是英语国家字体的几十倍到几百倍。直接下载全量字体数据对于带宽的消耗,计算量的消耗,用户体验的伤害都存在较大影响。因此需要有更有效的方法来改变这一现状。With the development of science and technology and the popularization of the Internet, a large number of personalized printed products have appeared one after another, such as: personalized customized photo albums, postcards, photo books, etc.; at the same time, a large number of online customized personalized printed products websites have also appeared one after another. Foreign ones such as Shutterfly, MixBook, Blurb, etc. Domestic ones such as Netease Impressionism, My Album.com, etc. Usually, for related products in Europe and the United States, due to the relatively small number of letters in English-speaking countries, there are only more than 100 commonly used characters, and the storage capacity of fonts is relatively small; therefore, the processing of fonts uses the method of downloading the full amount of font data to the local. However, due to the characteristics of Chinese fonts, the national standard GB2312 contains more than 6,000 glyphs even for a relatively small set of characters, and the size of the font file is dozens to hundreds of times that of English national fonts. Directly downloading the full amount of font data has a great impact on bandwidth consumption, calculation consumption, and user experience damage. Therefore, more effective methods are needed to change this situation.

为改变这种现状,国内一些网站普遍使用将所需的每个字体以位图的形式拼接出来,达到显示的目的。但这类方式在文字的放大、缩小、排版等方面捉襟见肘,难以为用户提供高质量、良好的用户体验。In order to change this situation, some domestic websites generally use each required font to be spliced out in the form of a bitmap to achieve the purpose of display. However, such methods are limited in terms of text enlargement, reduction, and typesetting, and it is difficult to provide users with high-quality and good user experience.

发明内容Contents of the invention

本发明要解决的技术问题是提供一种生成字体格式的方法及装置,用以解决现有网站普遍使用将所需的每个字体以位图的形式拼接出来,但这类方式在文字的放大、缩小、排版等方面捉襟见肘,难以提供高质量、良好的用户体验的问题。The technical problem to be solved by the present invention is to provide a method and device for generating a font format, which is used to solve the problem of splicing each required font in the form of a bitmap commonly used in existing websites, but this method is difficult to enlarge the text. It is difficult to provide high-quality and good user experience because of problems such as , zooming out, and typesetting.

为了解决上述技术问题,本发明实施例提供一种生成字体格式的方法,应用于一服务器,包括:In order to solve the above technical problems, an embodiment of the present invention provides a method for generating a font format, which is applied to a server, including:

接收终端应用程序传输的字体类型以及文字内容对应的Unicode编码;Receive the font type transmitted by the terminal application and the Unicode encoding corresponding to the text content;

根据所述字体类型和所述Unicode编码,得到所述字体类型的字体文件中与所述文字内容对应的字体格式集合;Obtain a set of font formats corresponding to the text content in the font file of the font type according to the font type and the Unicode encoding;

将所述字体格式集合封装成所述应用程序可使用的包含字体数据的文件后,发送给所述终端应用程序。After the font format collection is packaged into a file containing font data that can be used by the application program, it is sent to the terminal application program.

进一步地,所述将所述字体格式集合封装成所述应用程序可使用的包含字体数据的文件后,发送给所述应用程序之前,还包括:Further, after the said font format collection is encapsulated into a file containing font data usable by the application program, before sending to the application program, it also includes:

将所述字体格式集合中的每个字体格式,由第一字体格式转换成第二字体格式,其中,所述第二字体格式为所述应用程序可识别的字体格式。converting each font format in the font format set from the first font format to a second font format, wherein the second font format is a font format recognizable by the application program.

进一步地,所述第一字体格式为通用字体格式,所述第二字体格式为压缩字体格式。Further, the first font format is a common font format, and the second font format is a compressed font format.

进一步地,所述将所述字体格式集合中的每个字体格式,由第一字体格式转换成第二字体格式具体为:Further, the conversion of each font format in the font format set from the first font format to the second font format is specifically:

将所述字体格式集合中每个字体格式对应的矢量曲线由二次贝赛尔曲线转换为三次贝赛尔曲线,生成压缩字体格式集合。The vector curve corresponding to each font format in the font format set is converted from a quadratic Bezier curve to a cubic Bezier curve to generate a compressed font format set.

进一步地,所述文件为Flash播放程序使用的文件,其中所述文件中包括字体数据的映射关系以及用于供Flash播放程序识别的脚本代码。Further, the file is a file used by a Flash player, wherein the file includes a mapping relationship of font data and a script code for being recognized by the Flash player.

进一步地,所述接收终端应用程序传输的字体类型以及文字内容对应的Unicode编码前还包括:Further, before the font type transmitted by the receiving terminal application program and the Unicode encoding corresponding to the text content, it also includes:

存储预先设置的字体全集文件,所述字体全集文件包括字体类型以及字体类型对应的文字的通用字体格式。A pre-set font corpus file is stored, and the font corpus file includes a font type and a general font format of characters corresponding to the font type.

进一步地,所述根据所述字体类型和所述Unicode编码,得到所述字体类型的字体文件中与所述文字内容对应的字体格式集合具体为:Further, according to the font type and the Unicode encoding, the font format set corresponding to the text content in the font file of the font type obtained is specifically:

根据所述字体类型在所述字体全集文件中查找与所述字体类型对应的字体文件;Searching for a font file corresponding to the font type in the font encyclopedia file according to the font type;

在所述字体文件中查找与所述每个Unicode编码对应的通用字体格式生成所述文字内容对应的字体格式集合。Find the general font format corresponding to each Unicode encoding in the font file to generate a font format set corresponding to the text content.

本发明实施例提供一种生成字体格式的装置,包括:An embodiment of the present invention provides a device for generating a font format, including:

接收模块,用于接收终端应用程序传输的字体类型以及文字内容对应的Unicode编码;The receiving module is used to receive the font type transmitted by the terminal application program and the Unicode encoding corresponding to the text content;

生成模块,用于根据所述字体类型和所述Unicode编码,得到所述字体类型的字体文件中与所述文字内容对应的字体格式集合;A generating module, configured to obtain a font format set corresponding to the text content in the font file of the font type according to the font type and the Unicode encoding;

封装模块,用于将所述字体格式集合封装成所述应用程序可使用的包含字体数据的文件;An encapsulation module, configured to encapsulate the set of font formats into a file containing font data usable by the application;

发送模块,用于将所述文件发送给所述终端应用程序。A sending module, configured to send the file to the terminal application.

进一步地,所述装置,还包括:Further, the device also includes:

转换模块,用于将所述字体格式集合中的每个字体格式,由第一字体格式转换成第二字体格式,其中,所述第二字体格式为所述应用程序可识别的字体格式。The conversion module is configured to convert each font format in the font format set from a first font format to a second font format, wherein the second font format is a font format recognizable by the application program.

进一步地,所述装置,还包括:Further, the device also includes:

存储模块,用于存储预先设置的字体全集文件,所述字体全集文件包括字体类型以及字体类型对应的文字的通用字体格式。The storage module is used to store preset font corpus files, and the font corpus files include font types and common font formats of characters corresponding to the font types.

进一步地,所述生成模块具体包括:Further, the generating module specifically includes:

查找单元,用于根据所述字体类型在所述字体全集文件中查找与所述字体类型对应的字体文件;A search unit, configured to search for a font file corresponding to the font type in the font encyclopedia file according to the font type;

生成单元,用于在所述字体文件中查找与所述每个Unicode编码对应的通用字体格式生成所述文字内容对应的字体格式集合。A generating unit, configured to search the font file for a common font format corresponding to each Unicode code and generate a set of font formats corresponding to the text content.

本发明的上述技术方案的有益效果如下:The beneficial effects of above-mentioned technical scheme of the present invention are as follows:

上述方案中,通过在服务器端将字体格式封装成可以为应用程序所识别的文件,提供给应用程序使用,其生成速度快,数据量小,能有效的保持字体的原始效果,在任意缩放比例下都能完整呈现字体的全部内容,极大地提高了用户的使用体验。In the above solution, by encapsulating the font format on the server side into a file that can be recognized by the application program and providing it to the application program, the generation speed is fast, the data volume is small, and the original effect of the font can be effectively maintained. The entire content of the font can be fully presented under the screen, which greatly improves the user experience.

附图说明Description of drawings

图1为本发明实施例的所述方法总体流程图;Fig. 1 is the overall flowchart of the described method of the embodiment of the present invention;

图2为本发明实施例的所述方法详细流程图;Fig. 2 is the detailed flowchart of the described method of the embodiment of the present invention;

图3为本发明实施例的所述装置模块示意图。Fig. 3 is a schematic diagram of the device modules of the embodiment of the present invention.

具体实施方式detailed description

为使本发明要解决的技术问题、技术方案和优点更加清楚,下面将结合附图及具体实施例进行详细描述。In order to make the technical problems, technical solutions and advantages to be solved by the present invention clearer, the following will describe in detail with reference to the drawings and specific embodiments.

本发明针对现有网站普遍使用将所需的每个字体以位图的形式拼接出来,但这类方式在文字的放大、缩小、排版等方面捉襟见肘,难以提供高质量、良好的用户体验的问题,提供一种生成字体格式的方法及装置。The present invention splices each required font in the form of a bitmap for the common use of existing websites, but this type of method is stretched in terms of text enlargement, reduction, typesetting, etc., and it is difficult to provide high-quality and good user experience. Provided are a method and device for generating a font format.

如图1所示,本发明实施例的所述生成字体格式的方法,包括:As shown in Figure 1, the method for generating a font format in the embodiment of the present invention includes:

步骤10,接收终端应用程序传输的字体类型以及文字内容对应的Unicode编码;Step 10, receiving the font type transmitted by the terminal application program and the Unicode encoding corresponding to the text content;

步骤20,根据所述字体类型和所述Unicode编码,得到所述字体类型的字体文件中与所述文字内容对应的字体格式集合;Step 20, according to the font type and the Unicode encoding, obtain the font format set corresponding to the text content in the font file of the font type;

步骤30,将所述字体格式集合封装成所述应用程序可使用的包含字体数据的文件后,发送给所述终端应用程序。Step 30, after encapsulating the set of font formats into a file containing font data usable by the application program, sending it to the terminal application program.

应当说明的是,终端应用程序根据用于输入的内容,通过HTTP协议(超文本传输协议)将所述字体类型和所述文字内容对应的Unicode编码发送给所述服务器,服务器将查找的字体格式集合封装为可以为应用程序所识别的文件,提供给应用程序使用,减少了用户的数据传输量,满足了用户可以及时使用不同字体的需求;同时,此种形式的字体格式处理方法,在缩放、排版上更灵活,效率更高,能有效的保持字体的原始效果,提高了用户的体验效果。It should be noted that, according to the input content, the terminal application sends the font type and the Unicode encoding corresponding to the text content to the server through the HTTP protocol (hypertext transfer protocol), and the server will search for the font format The collection is packaged as a file that can be recognized by the application program, and provided to the application program, which reduces the user's data transmission volume and meets the user's need to use different fonts in a timely manner; , The typesetting is more flexible and efficient, and it can effectively maintain the original effect of the font and improve the user experience.

为了方便字体格式的生成,在步骤10之前还包括:存储预先设置的字体全集文件,所述字体全集文件包括字体类型以及字体类型对应的文字的通用字体格式。In order to facilitate the generation of the font format, before step 10, it also includes: storing a preset font corpus file, the font corpus file includes the font type and the general font format of the characters corresponding to the font type.

应当说明的是,该字体全集文件中包含多个字体类型以及字体类型对应的文字的通用字体格式,如仿宋字体类型对应的所有文字的通用字体格式,对于中文字体,应至少满足GB2312标准,优选地,为满足GBK或GB18030及以上的标准;所述字体全集文件可以是标准的TTF(TrueTypeFont,一种字库名称,代表通用字体)文件,也可以为OTF(OpenTypeFont,一种字库名称)文件,该字体全集文件设置好后存储在服务器中,进一步地,可以根据需要,对该字体全集文件随时进行添加、更改、删除等操作,使得终端用户不需要更新、下载相应字体文件,便可使用该字体。It should be noted that the font collection file contains multiple font types and the general font format of the characters corresponding to the font type, such as the general font format of all the characters corresponding to the imitation Song font type. For Chinese fonts, it should at least meet the GB2312 standard, preferably Specifically, in order to meet the standards of GBK or GB18030 and above; the font collection file can be a standard TTF (TrueTypeFont, a font name, representing a general font) file, or an OTF (OpenTypeFont, a font name) file, The complete set of font files is stored in the server after being set. Further, operations such as adding, changing, and deleting the complete set of font files can be performed at any time according to needs, so that end users can use the complete set of fonts without updating or downloading corresponding font files. font.

本发明另一实施例中,所述步骤20具体包括:In another embodiment of the present invention, the step 20 specifically includes:

步骤21,根据所述字体类型在所述字体全集文件中查找与所述字体类型对应的字体文件;Step 21, searching for a font file corresponding to the font type in the font encyclopedia file according to the font type;

步骤22,在所述字体文件中查找与所述每个Unicode编码对应的通用字体格式生成所述文字内容对应的字体格式集合。Step 22: Search the font file for the general font format corresponding to each Unicode code to generate a font format set corresponding to the text content.

因字体文件在服务器中是以字体类型区分的,所以在生成字体格式集合时也是根据字体类型先定位到相应的字体文件,进而在从所述字体文件中查找与所述每个Unicode编码匹配的字体格式组成字体格式集合。Because the font files are distinguished by font type in the server, when generating the font format set, the corresponding font file is first located according to the font type, and then the font file that matches each Unicode code is searched. Font formats make up a font format collection.

应当说明的是,所述服务器中存储的字体格式可能并不是应用程序所识别的字体格式,因此,本发明实施例的所述方法,在步骤30之前,还包括:It should be noted that the font format stored in the server may not be the font format recognized by the application program. Therefore, the method in the embodiment of the present invention, before step 30, further includes:

将所述字体格式集合中的每个字体格式,由第一字体格式转换成第二字体格式,其中,所述第二字体格式为所述应用程序可识别的字体格式。converting each font format in the font format set from the first font format to a second font format, wherein the second font format is a font format recognizable by the application program.

在所述应用程序的使用环境为Flash情况时,该运行环境需要使用CFF(CompactFontFormat,压缩字体格式)的字体格式,因此,本发明实施例的所述将所述字体格式集合中的每个字体格式,由第一字体格式转换成第二字体格式具体为:When the usage environment of the application program is Flash, the running environment needs to use the font format of CFF (CompactFontFormat, compressed font format). format, the conversion from the first font format to the second font format is as follows:

将所述字体格式集合中每个字体格式对应的矢量曲线由二次贝赛尔曲线转换为三次贝赛尔曲线,生成压缩字体格式集合,其中,所述第一字体格式为通用字体格式,所述第二字体格式为压缩字体格式。converting the vector curve corresponding to each font format in the font format set from a quadratic Bezier curve to a cubic Bezier curve to generate a compressed font format set, wherein the first font format is a general font format, and the The second font format is a compressed font format.

应当说明的是,所述利用贝塞尔曲线进行升阶操作具体为:It should be noted that the step-up operation using Bezier curves is specifically:

利用B(t)=(1-t)B(t)+tB(t)此特性来进行升阶操,把曲线方程中的每一项bi,n(t)Pi每项乘上(1-t)或t,让每一项都往上升一阶,具体示例如下:Use the characteristic of B(t)=(1-t)B(t)+tB(t) to carry out the step-up operation, and multiply each item b i,n(t) P i in the curve equation by ( 1-t) or t, let each item go up one level, the specific examples are as follows:

(1-t)2P0+2(1-t)tP1+t2P2 (1-t) 2 P 0 +2(1-t)tP 1 +t 2 P 2

=(1-t)3P0+(1-t)2tP0+2(1-t)2tP1+2(1-t)t2P1+(1-t)t2P2+t3P2 =(1-t) 3 P 0 +(1-t) 2 tP 0 +2(1-t) 2 tP 1 +2(1-t)t 2 P 1 +(1-t)t 2 P 2 + t 3 P 2

=(1-t)3P0+3(1-t)2t(P0+2P1)/3+3(1-t)t2(2P1+P2)/3+t3P2 =(1-t) 3 P 0 +3(1-t) 2 t(P 0 +2P 1 )/3+3(1-t)t 2 (2P 1 +P 2 )/3+t 3 P 2

进一步地,在所述应用程序的使用环境为Flash情况时,应将所述字体格式集合封装成供所述Flash播放程序可使用的包含字体数据的SWF文件(SWF是ShockWaveFlash的缩写,它是一种支持矢量和点阵图形的动画文件格式,SWF文件通常也被称为Flash文件);其中所述SWF文件中包括字体数据的映射关系以及用于供Flash播放程序识别的脚本代码。Further, when the usage environment of the application program is a Flash situation, the font format collection should be packaged into a SWF file (SWF is the abbreviation of ShockWaveFlash, which is a An animation file format that supports vector and dot-matrix graphics, SWF files are also commonly referred to as Flash files); wherein the SWF files include the mapping relationship of font data and script codes for recognition by Flash player programs.

具体地,根据Adobe《SWFFileFormatSpecificationVersion19》的格式描述要求,需要生成若干数据结构和SWFTag(标签),包括:Specifically, according to the format description requirements of Adobe's "SWFFileFormatSpecificationVersion19", several data structures and SWFTags (tags) need to be generated, including:

SWFHeader,用于描述SWF的基本信息;SWFHeader, used to describe the basic information of SWF;

FileAttributes,描述对FlashPlayer的配置;FileAttributes, describing the configuration of FlashPlayer;

SetBackgroundColor,设定背景颜色;SetBackgroundColor, set the background color;

DefineFont4,保存CFF字体实例;DefineFont4, save the CFF font instance;

DefineBinaryData,保存应用所使用的JSON描述信息;DefineBinaryData, save the JSON description information used by the application;

DoABC2,保存用于导出字体的ActionScriptByteCode(ABC码)程序;DoABC2, save the ActionScriptByteCode (ABC code) program used to export fonts;

ExportAssets,提供应用导入SWF文件时的导出名称;ExportAssets, providing the export name when the application imports the SWF file;

SymbolClass,将CFF字体资源、JSON描述信息资源与ABC程序进行关联;SymbolClass, which associates CFF font resources, JSON description information resources with ABC programs;

ShowFrame,告知FlashPlayer在显示列表上显示的内容;ShowFrame, tells FlashPlayer what to display on the display list;

End,标记SWF结尾。End, marks the end of the SWF.

其中最为重要的是用于保存CFF字体实例的DefineFont4、DefineBinaryData、DoABC2、SymbolClass四个tag,。The most important ones are the four tags DefineFont4, DefineBinaryData, DoABC2, and SymbolClass used to save CFF font instances.

DefineBinaryData保存字体描述的JSON数据,应用程序根据描述的应用数据对字体进行操作,其包括:fontname、contained_characters、missing_characters等数据。DefineBinaryData saves the JSON data of the font description, and the application operates on the font according to the described application data, which includes: fontname, contained_characters, missing_characters and other data.

DoABC2包含对应的导出程序,其是一个类似如下的程序:DoABC2 contains a corresponding export program, which is a program similar to the following:

上述程序代码用于当导入字体集合和JSON描述时提供给FlashPlayer的程序接口。The above program code is used for the program interface provided to FlashPlayer when importing font collection and JSON description.

如图2所示,以将字体集合封装成SWF文件,提供给Flash播放程序使用为例,将本发明所述方法详细流程说明如下:As shown in Figure 2, with the font collection being packaged into SWF files, providing the Flash player for use as an example, the detailed process of the method of the present invention is described as follows:

首先在服务器端存储设置好的字体全集文件,以供查找字体格式使用;用户在终端使用应用程序时,涉及到对字体的操作时,输入字体的类型,以及文字内容,应用程序将用户输入的字体类型和文字内容对应的Unicode编码通过HTTP协议传输给服务器端,例如用户选择的字体类型为“楷体”,输入的文字内容为“方正”,其对应的Unicode编码为“U+65B9,U+6B63”,此时,应用程序会将字体类型“楷体”以及“U+65B9,U+6B63”传输给服务器;服务器根据接收的字体类型和所述Unicode编码得到所述字体类型对应的字体文件中与所述“U+65B9”和“U+6B63”对应的字体格式构成字体格式集合;然后,服务器会将字体格式集合中的每个字体格式对应的矢量曲线由二次贝赛尔曲线转换为三次贝赛尔曲线,生成压缩字体格式集合;接下来,服务器会将所述压缩字体格式集合封装至SWF文件中,并在所述SWF文件中嵌入使Flash播放程序识别的脚本代码,最后将所述SWF文件通过HTTP协议发送给所述终端应用程序,供所述终端应用程序使用。First, store the set font complete set file on the server side for searching font format; when the user uses the application program on the terminal, when it comes to the operation of the font, the type of font and the text content input by the user will be input by the application program The Unicode encoding corresponding to the font type and text content is transmitted to the server through the HTTP protocol. For example, if the font type selected by the user is "Kai Ti", the input text content is "Founder", and the corresponding Unicode encoding is "U+65B9, U+ 6B63", at this time, the application will transmit the font type "Kai Ti" and "U+65B9, U+6B63" to the server; the server obtains the font file corresponding to the font type according to the received font type and the Unicode code The font formats corresponding to the "U+65B9" and "U+6B63" form a font format set; then, the server converts the vector curve corresponding to each font format in the font format set from a quadratic Bezier curve to Cubic Bezier curves to generate a set of compressed font formats; next, the server will encapsulate the set of compressed font formats into a SWF file, and embed script codes in the SWF file for the The SWF file is sent to the terminal application program through the HTTP protocol for use by the terminal application program.

上述实施例,通过将字体格式集合以矢量字体的形式封装为SWF文件,提供给Flash播放程序使用,规避了传统将字体以位图的形式拼接出来传给应用程序使用时造成的文字变形、失真的缺点;并且此种文字格式生成方式生成速度快,数据量小;同时标准的矢量字体格式,能有效的保持字体的原始效果,在任意缩放比例下都能完整呈现字体的全部内容;并且可以直接用于专业排版系统,在文字排版、改变文字展现形式、更改字体颜色、增加字体特效的功能上相比传统位图方式有更灵活的表现形式;并且通过增加、修改、删除服务器上的字体文件,可以使得用户不需要自己下载、安装相应字体文件,即可使用该字体,极大地提高了用户使用的便捷性。综上所述,本发明所述方法方便了用户的使用,极大的提高了用户的使用体验效果。In the above-mentioned embodiment, by encapsulating the font format collection into a SWF file in the form of vector fonts, and providing it to the Flash player program, it avoids the text deformation and distortion caused by the traditional splicing of fonts in the form of bitmaps and passing them to the application program for use. disadvantages; and this text format generation method has fast generation speed and small data volume; at the same time, the standard vector font format can effectively maintain the original effect of the font, and can fully present all the content of the font at any scaling ratio; and can Directly used in professional typesetting systems, it has a more flexible form of expression than the traditional bitmap method in terms of text typesetting, changing text display form, changing font color, and adding font effects; and by adding, modifying, and deleting fonts on the server file, so that the user can use the font without downloading and installing the corresponding font file by himself, which greatly improves the convenience of the user. To sum up, the method of the present invention facilitates the use of the user and greatly improves the user experience.

如图3所示,本发明实施例的生成字体格式的装置,包括:As shown in Figure 3, the device for generating a font format according to the embodiment of the present invention includes:

接收模块11,用于接收终端应用程序传输的字体类型以及文字内容对应的Unicode编码;The receiving module 11 is used to receive the font type transmitted by the terminal application program and the Unicode encoding corresponding to the text content;

生成模块12,用于根据所述字体类型和所述Unicode编码,得到所述字体类型的字体文件中与所述文字内容对应的字体格式集合;A generating module 12, configured to obtain a font format set corresponding to the text content in the font file of the font type according to the font type and the Unicode encoding;

封装模块13,用于将所述字体格式集合封装成所述应用程序可使用的包含字体数据的文件;An encapsulation module 13, configured to encapsulate the set of font formats into a file containing font data usable by the application;

发送模块14,用于将所述文件发送给所述终端应用程序。The sending module 14 is configured to send the file to the terminal application program.

本发明另一实施例中,所述装置,还包括:In another embodiment of the present invention, the device further includes:

转换模块,用于将所述字体格式集合中的每个字体格式,由第一字体格式转换成第二字体格式,其中,所述第二字体格式为所述应用程序可识别的字体格式。The conversion module is configured to convert each font format in the font format set from a first font format to a second font format, wherein the second font format is a font format recognizable by the application program.

本发明又一实施例中,所述装置,还包括:In yet another embodiment of the present invention, the device further includes:

存储模块,用于存储预先设置的字体全集文件,所述字体全集文件包括字体类型以及字体类型对应的文字的通用字体格式。The storage module is used to store preset font corpus files, and the font corpus files include font types and common font formats of characters corresponding to the font types.

应当说明的是,所述生成模块具体包括:It should be noted that the generating module specifically includes:

查找单元,用于根据所述字体类型在所述字体全集文件中查找与所述字体类型对应的字体文件;A search unit, configured to search for a font file corresponding to the font type in the font encyclopedia file according to the font type;

生成单元,用于在所述字体文件中查找与所述每个Unicode编码对应的通用字体格式生成所述文字内容对应的字体格式集合。A generating unit, configured to search the font file for a common font format corresponding to each Unicode code and generate a set of font formats corresponding to the text content.

需要说明的是,该装置实施例是上述方法相对应的装置,上述方法的所有实现方式均适用于该装置实施例中,也能达到与上述方法相同的技术效果。It should be noted that this device embodiment is a device corresponding to the above-mentioned method, all implementation modes of the above-mentioned method are applicable to this device embodiment, and can also achieve the same technical effect as the above-mentioned method.

以上所述的是本发明的优选实施方式,应当指出对于本技术领域的普通人员来说,在不脱离本发明所述原理前提下,还可以作出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。What has been described above is a preferred embodiment of the present invention. It should be pointed out that for those skilled in the art, some improvements and modifications can also be made without departing from the principle of the present invention. These improvements and modifications should also be considered as Be the protection scope of the present invention.

Claims (11)

1. generate a method for font format, be applied to a server, it is characterized in that, comprising:
The font type of receiving terminal application transfer and word content corresponding Unicode coding;
Encode according to described font type and described Unicode, obtain font format set corresponding with described word content in the font file of described font type;
After described font format group encapsulates being become described application program is spendable and comprising the file of character font data, send to described end application.
2. method according to claim 1, is characterized in that, described described font format group encapsulates is become described application program is spendable and comprises the file of character font data after, before sending to described application program, also comprise:
By each font format in described font format set, convert the second font format to by the first font format, wherein, described second font format is the discernible font format of described application program.
3. method according to claim 2, is characterized in that, described first font format is general font form, and described second font format is compressed font form.
4. method according to claim 3, is characterized in that, described by each font format in described font format set, converts the second font format to be specially by the first font format:
Be three Bayside curves by vector curve corresponding for each font format in described font format set by secondary Bayside Curve transform, generate the set of compressed font form.
5. method according to claim 4, is characterized in that, described file is the file that Flash playing program uses, and wherein said file comprises the mapping relations of character font data and the scripted code for the identification of confession Flash playing program.
6. method according to claim 1, is characterized in that, the font type of described receiving terminal application transfer and word content corresponding Unicode coding before also comprise:
Store the font complete or collected works file that pre-sets, described font complete or collected works file comprises the general font form of font type and word corresponding to font type.
7. method according to claim 6, is characterized in that, describedly encodes according to described font type and described Unicode, obtains font format set corresponding with described word content in the font file of described font type and is specially:
In described font complete or collected works file, the font file corresponding with described font type is searched according to described font type;
In described font file, search the general font form of encoding corresponding with described each Unicode generate font format set corresponding to described word content.
8. generate a device for font format, it is characterized in that, comprising:
Receiver module, for the font type of receiving terminal application transfer and Unicode coding corresponding to word content;
Generation module, for encoding according to described font type and described Unicode, obtains font format set corresponding with described word content in the font file of described font type;
Package module, for becoming the spendable file comprising character font data of described application program by described font format group encapsulates;
Sending module, for sending to described end application by described file.
9. device according to claim 8, is characterized in that, also comprises:
Modular converter, for by each font format in described font format set, converts the second font format to by the first font format, and wherein, described second font format is the discernible font format of described application program.
10. device according to claim 8, is characterized in that, also comprises:
Memory module, for storing the font complete or collected works file pre-set, described font complete or collected works file comprises the general font form of font type and word corresponding to font type.
11. devices according to claim 10, is characterized in that, described generation module specifically comprises:
Search unit, for searching the font file corresponding with described font type according to described font type in described font complete or collected works file;
Generation unit, generates font format set corresponding to described word content for searching the general font form of encoding corresponding with described each Unicode in described font file.
CN201410241118.3A 2014-05-30 2014-05-30 A kind of method and device generating font format Pending CN105224509A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410241118.3A CN105224509A (en) 2014-05-30 2014-05-30 A kind of method and device generating font format

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410241118.3A CN105224509A (en) 2014-05-30 2014-05-30 A kind of method and device generating font format

Publications (1)

Publication Number Publication Date
CN105224509A true CN105224509A (en) 2016-01-06

Family

ID=54993488

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410241118.3A Pending CN105224509A (en) 2014-05-30 2014-05-30 A kind of method and device generating font format

Country Status (1)

Country Link
CN (1) CN105224509A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105893335A (en) * 2016-03-30 2016-08-24 广州华多网络科技有限公司 Method and device for displaying text
CN106168901A (en) * 2016-06-23 2016-11-30 北京奇虎科技有限公司 Application program font customizing method and control method and related device
CN109542507A (en) * 2018-10-26 2019-03-29 深圳点猫科技有限公司 A kind of GBK code processing method and electronic equipment based on educational system
CN110826005A (en) * 2019-11-13 2020-02-21 北大方正集团有限公司 File generation method, device, electronic device and storage medium
CN111414730A (en) * 2020-03-18 2020-07-14 中孚安全技术有限公司 Method, system, terminal and storage medium for acquiring document character format information

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101963956A (en) * 2010-09-19 2011-02-02 深圳市万兴软件有限公司 Method and device for converting XML document into PPTX document
CN101996160A (en) * 2009-08-10 2011-03-30 北大方正集团有限公司 Method and system for processing script data
CN102063415A (en) * 2009-11-16 2011-05-18 北大方正集团有限公司 Method and system for embedding single-byte fonts in PDF (Portable Document Format) file
CN102063416A (en) * 2009-11-16 2011-05-18 北大方正集团有限公司 Method and system for embedding double-byte fonts into PDF file
CN102402500A (en) * 2011-11-23 2012-04-04 上海居冠软件有限公司 Method and system for converting PDF (Portable document Format) file into SWF (Single-wire Fall) file
CN102467515A (en) * 2010-10-28 2012-05-23 亚太戏网股份有限公司 System for generating webpage totem by totem server
CN103365894A (en) * 2012-03-29 2013-10-23 天津书生软件技术有限公司 Font format conversion method and device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101996160A (en) * 2009-08-10 2011-03-30 北大方正集团有限公司 Method and system for processing script data
CN102063415A (en) * 2009-11-16 2011-05-18 北大方正集团有限公司 Method and system for embedding single-byte fonts in PDF (Portable Document Format) file
CN102063416A (en) * 2009-11-16 2011-05-18 北大方正集团有限公司 Method and system for embedding double-byte fonts into PDF file
CN101963956A (en) * 2010-09-19 2011-02-02 深圳市万兴软件有限公司 Method and device for converting XML document into PPTX document
CN102467515A (en) * 2010-10-28 2012-05-23 亚太戏网股份有限公司 System for generating webpage totem by totem server
CN102402500A (en) * 2011-11-23 2012-04-04 上海居冠软件有限公司 Method and system for converting PDF (Portable document Format) file into SWF (Single-wire Fall) file
CN103365894A (en) * 2012-03-29 2013-10-23 天津书生软件技术有限公司 Font format conversion method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
朱开玉: "CAPP系统中动态创建TrueType字体的研究", 《计算机工程》 *
郭海: "纳西象形文轮廓字体设计制作及植入研究", 《中国优秀硕士论文全文数据库 信息科技辑》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105893335A (en) * 2016-03-30 2016-08-24 广州华多网络科技有限公司 Method and device for displaying text
CN105893335B (en) * 2016-03-30 2019-07-12 广州华多网络科技有限公司 The method and apparatus of display text
CN106168901A (en) * 2016-06-23 2016-11-30 北京奇虎科技有限公司 Application program font customizing method and control method and related device
CN109542507A (en) * 2018-10-26 2019-03-29 深圳点猫科技有限公司 A kind of GBK code processing method and electronic equipment based on educational system
CN110826005A (en) * 2019-11-13 2020-02-21 北大方正集团有限公司 File generation method, device, electronic device and storage medium
CN111414730A (en) * 2020-03-18 2020-07-14 中孚安全技术有限公司 Method, system, terminal and storage medium for acquiring document character format information

Similar Documents

Publication Publication Date Title
US11695820B2 (en) Commerce oriented uniform resource locater (URL) shortener
US8209598B1 (en) Exporting electronic documents from rich internet applications
CN102982010B (en) The method and apparatus extracting file structure
CN104731590B (en) A kind of user interface controls implementation method and device
CN105224509A (en) A kind of method and device generating font format
CN103389992A (en) Structured data storage method and device
WO2016124074A1 (en) Information processing method, client, server and computer storage medium
US11599727B2 (en) Intelligent text cleaning method and apparatus, and computer-readable storage medium
CN104462522A (en) File online preview method, mobile terminal and server
CN108228676A (en) Information extraction method and system
CN107832469A (en) A kind of generation method and device of enterprise logo images
CN103678698A (en) Method and device for improving on-line browsing loading speed of PDF document
CN108121539A (en) Component processing method and apparatus
WO2020015220A1 (en) Method and apparatus for downloading data based on pdf document, and storage medium and terminal
CN112486482A (en) Page display method and device
CN113900650A (en) Data processing method and device, electronic equipment and readable storage medium
CN105824647A (en) Form page generating method and device
CN101295251A (en) Interface publishing method and device
CN110941401B (en) Printing method and device
US8930808B2 (en) Processing rich text data for storing as legacy data records in a data storage system
CN103853845A (en) Dynamic analytic method of complex form
CN108932330B (en) Data display method and device
US20150036154A1 (en) Methods and apparatuses for displaying text block and processing text block
CN101419618B (en) In-text information displaying method and apparatus
CN102651018A (en) Method and device for displaying input information correlation content

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20160106