WO2020103245A1 - 字体渲染方法、装置及计算机可读存储介质 - Google Patents

字体渲染方法、装置及计算机可读存储介质

Info

Publication number
WO2020103245A1
WO2020103245A1 PCT/CN2018/121554 CN2018121554W WO2020103245A1 WO 2020103245 A1 WO2020103245 A1 WO 2020103245A1 CN 2018121554 W CN2018121554 W CN 2018121554W WO 2020103245 A1 WO2020103245 A1 WO 2020103245A1
Authority
WO
WIPO (PCT)
Prior art keywords
font
information
text
rendering
template
Prior art date
Application number
PCT/CN2018/121554
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 KR1020217011581A priority Critical patent/KR102523843B1/ko
Priority to JP2021529688A priority patent/JP7210733B2/ja
Publication of WO2020103245A1 publication Critical patent/WO2020103245A1/zh
Priority to US17/238,630 priority patent/US11507727B2/en

Links

Images

Classifications

    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/151Transformation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T13/00Animation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T13/00Animation
    • G06T13/802D [Two Dimensional] animation, e.g. using sprites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4007Scaling of whole images or parts thereof, e.g. expanding or contracting based on interpolation, e.g. bilinear interpolation

Definitions

  • the present invention relates to the field of word processing technology, and in particular, to a font rendering method, a font rendering device, and a computer-readable storage medium.
  • the traditional text layout method is from left to right, from top to bottom, line spacing, column spacing fixed mode, not creative enough, the page effect is too monotonous; emoticons display fonts can only be fixed words, and need to be pre-made, can not be based on The user enters the real-time rendering effect; Chinese characters cannot be extracted when copying the picture expression; in addition, the drawing methods on the market are drawn through the upper layer or the CPU (Central Processing Unit). Due to the large amount of calculation, it is not It is suitable for use on low-performance terminal devices, and it can't do a cool effect.
  • CPU Central Processing Unit
  • the present invention aims to solve at least one of the technical problems existing in the prior art or related technologies.
  • one aspect of the present invention is to propose a font rendering method.
  • Another aspect of the present invention is to provide a font rendering device.
  • Another aspect of the present invention is to propose a computer-readable storage medium.
  • the present invention proposes a font rendering method, including: receiving a character string to be rendered, reading a font file; parsing the font file, obtaining text font information and template information corresponding to the string; according to the text font information and template The information generates an animation unit; renders the animation unit.
  • a character string to be rendered is received, for example, a character string input by a user is received from a client, a font file such as a dynamic TTF (TrueTypeFont) font file is read, and the font file is parsed to obtain characters
  • TTF TrueTypeFont
  • the text font information and template information corresponding to the string, the text font information and the template information are merged to generate an animation unit, wherein the frequency of the animation can be a fixed frame interval or an irregular frame interval, and then the animation unit is rendered and output after rendering Perform effects presentation.
  • the corresponding template effects can be customized according to different font effects and different ranks, supporting mixed text sizes, custom text positions, custom text colors and special effects, more suitable for scene matching and graphics Combining, so as to more fully express the semantic primary and secondary, enhance the visual impact of the text, highlight the language center of gravity, highlight the artistic conception of the text, and can instantly present any personalized effect of any style according to user input, which greatly meets the user's Personalized needs.
  • the method further includes: performing interpolation operations on each motion attribute in the text font information and / or template information; the interpolation operations include the following Any one or a combination of: scaling, rotation, displacement, color, transparency, stroke, shadow, glow.
  • each motion attribute in the text glyph information and / or template information is interpolated to make the motion effect of the font smoother and smoother, and Realize the transformation of glyphs and templates, such as scaling, rotation, displacement, color, transparency, stroke, shadow, light emission, etc., so as to ensure the diversification, personalization, coolness of fonts, and enhance visual effects.
  • the step of rendering the animation unit specifically includes: performing frame layer rendering and color filling on each frame of data of the animation unit through the GPU; wherein, frame layer rendering includes: Background effect drawing, single-word image effect drawing, overall image effect drawing, font effect drawing, foreground effect drawing; color filling methods include any one or a combination of the following: gradient, texture, solid color, animation.
  • the present invention is based on OpenGL (Open Graphics Library Open Graphics Library) technology, using GPU (Graphics Processing Unit, graphics processor) to render the animation unit
  • OpenGL is a hardware-independent software interface, in various All platforms can be transplanted, so both system-level access and application-level access can be well compatible.
  • the animation unit is sent to the GPU in the data format of each frame for frame layer rendering, and color filling is performed.
  • the frame layer data is extracted from the GPU and the frame bitmap data is formed in the memory.
  • Frame bitmap data is output to external applications for rendering.
  • the frame layer rendering process includes background effect drawing, single-word image effect drawing, overall image effect drawing, font effect drawing, and foreground effect drawing; color filling methods include but are not limited to any one of gradient, texture, solid color, animation, or combination.
  • the present invention is based on OpenGL technology, uses GPU for font rendering and animation rendering, improves rendering speed, saves consumption of system resources, ensures system fluency, has a good fluency experience for users, and is suitable for low performance
  • the terminal can also obtain more diverse and cool dynamic hi-burst effects, which greatly meets the user's personalized needs for font effects, and can also install font files through the font installation interface of the computer device, further improving the user experience.
  • the text font information includes any one or a combination of the following: a whole character basemap, a part basemap, and an outline basemap; and the template information includes any one or a combination of the following: dynamic text layout Information, text dynamic stretching, rotation information, text dynamic color information, pendant dynamic attribute information, text overall dynamic mask information; character string consists of at least one character, the character includes any one or a combination of the following: Chinese characters, Arabic characters , English characters.
  • the text font information consists of a single whole-character basemap or a combination of the whole-word basemap and one or more component basemaps and outline basemaps; template information includes but is not limited to one or more of the following information A: text dynamic typesetting information, text dynamic stretching, rotation information, text dynamic color information, pendant dynamic attribute information, text overall dynamic mask information; character string can be any one of Chinese characters, Arabic characters, English characters or Its combination.
  • the font typesetting method breaks the traditional text typesetting method, supports mixed text size, and more fully expresses the semantic primary and secondary; supports custom text position, enhances the visual impact of the text; supports any text color and
  • the definition of special effects can highlight the language center of gravity; it has a sense of design, and is more suitable for scene matching with graphics and text to highlight the artistic conception of words.
  • the font file includes a standard black and white character TrueType format font file, and any one or a combination of the following: a template attribute table, a glyph typesetting information table, a glyph rendering information table, a rendering information metadata table , Picture animation information table, shader attribute table, picture table, shader source code table.
  • the font file includes one or more of the following in addition to the standard black-and-white TrueType format font file: template attribute table, font layout information table, font rendering information table, rendering information metadata table, and pictures Animation information table, shader attribute table, picture table, and shader source code table, which can ensure the diversity, personalization, and coolness of fonts, and enhance the user's experience of personalized text expressions.
  • the invention also provides a font rendering device, including: a memory for storing a computer program; a processor for executing the computer program to: receive a character string to be rendered, read a font file; parse the font file, obtain a character string Corresponding text font information and template information; generate an animation unit according to the text font information and template information; render the animation unit.
  • a font rendering device including: a memory for storing a computer program; a processor for executing the computer program to: receive a character string to be rendered, read a font file; parse the font file, obtain a character string Corresponding text font information and template information; generate an animation unit according to the text font information and template information; render the animation unit.
  • a character string to be rendered is received, for example, a character string input by a user is received from a client, a font file such as a dynamic TTF (TrueTypeFont) font file is read, and the font file is parsed to obtain characters
  • TTF TrueTypeFont
  • the text font information and template information corresponding to the string, the text font information and the template information are merged to generate an animation unit, wherein the frequency of the animation can be a fixed frame interval or an irregular frame interval, and then the animation unit is rendered and output after rendering Perform effects presentation.
  • the font rendering device of the present invention can customize the corresponding template effect according to different font effects and different rows and columns, support mixed text size, custom text position, custom text color and special effects, more suitable for scene matching and graphics Combining, so as to more fully express the semantic primary and secondary, enhance the visual impact of the text, highlight the language center of gravity, highlight the artistic conception of the text, and can instantly present any personalized effect of any style according to user input, which greatly meets the user's Personalized needs.
  • the processor is further configured to execute a computer program to: before the step of generating the animation unit according to the text font information and template information, for each motion attribute in the text font information and / or template information Perform interpolation operations; interpolation operations include any one or a combination of the following: scaling, rotation, displacement, color, transparency, stroke, shadow, and glow.
  • each motion attribute in the text glyph information and / or template information is interpolated to make the motion effect of the font smoother and smoother, and Realize the transformation of glyphs and templates, such as scaling, rotation, displacement, color, transparency, stroke, shadow, light emission, etc., so as to ensure the diversification, personalization, coolness of fonts, and enhance visual effects.
  • the processor is specifically configured to execute a computer program to: perform frame layer rendering and color fill on each frame of data of the animation unit through the GPU; wherein, frame layer rendering includes: Background effect drawing, single-word image effect drawing, overall image effect drawing, font effect drawing, foreground effect drawing; color filling methods include any one or a combination of the following: gradient, texture, solid color, animation.
  • the present invention is based on OpenGL (Open Graphics Library Open Graphics Library) technology, using GPU (Graphics Processing Unit, graphics processor) to render the animation unit
  • OpenGL is a hardware-independent software interface, in various All platforms can be transplanted, so both system-level access and application-level access can be well compatible.
  • the animation unit is sent to the GPU in the data format of each frame for frame layer rendering, and color filling is performed.
  • the frame layer data is extracted from the GPU and the frame bitmap data is formed in the memory.
  • Frame bitmap data is output to external applications for rendering.
  • the frame layer rendering process includes background effect drawing, single-word image effect drawing, overall image effect drawing, font effect drawing, and foreground effect drawing; color filling methods include but are not limited to any one or combination of gradient, texture, and solid color.
  • the present invention is based on OpenGL technology, uses GPU for font rendering and animation rendering, improves rendering speed, saves consumption of system resources, ensures system fluency, has a good fluency experience for users, and is suitable for low performance Terminal, and can obtain more diverse and cool dynamic hi-burst effects, which greatly meets the user's personalized needs for font effects, and can also install font files through the font installation interface of the computer device, further improving the user experience.
  • the text font information includes any one or a combination of the following: a whole character basemap, a part basemap, and an outline basemap; and the template information includes any one or a combination of the following: dynamic text layout Information, text dynamic stretching, rotation information, text dynamic color information, pendant dynamic attribute information, text overall dynamic mask information; character string consists of at least one character, the character includes any one or a combination of the following: Chinese characters, Arabic characters , English characters.
  • the text font information consists of a single whole-character basemap or a combination of the whole-word basemap and one or more component basemaps and outline basemaps; template information includes but is not limited to one or more of the following information A: text dynamic typesetting information, text dynamic stretching, rotation information, text dynamic color information, pendant dynamic attribute information, text overall dynamic mask information; character string can be any one of Chinese characters, Arabic characters, English characters or Its combination.
  • the font typesetting method breaks the traditional text typesetting method, supports mixed text size, and more fully expresses the semantic primary and secondary; supports custom text position, enhances the visual impact of the text; supports any text color and
  • the definition of special effects can highlight the language center of gravity; it has a sense of design, and is more suitable for scene matching with graphics and text to highlight the artistic conception of words.
  • the font file includes a standard black and white character TrueType format font file, and any one or a combination of the following: a template attribute table, a glyph typesetting information table, a glyph rendering information table, a rendering information metadata table , Picture animation information table, shader attribute table, picture table, shader source code table.
  • the font file in addition to the standard black and white font TrueType format font file, the font file also includes one or more of the following combined template attribute table, font layout information table, font rendering information table, rendering information metadata table, picture animation
  • the information table, shader attribute table, picture table, and shader source code table can ensure the diversity, personalization, and coolness of the font, and enhance the user's experience of personalized text expressions.
  • the rendered font effect upon receiving a command to copy the rendered font effect, the rendered font effect is restored to the character string and pasted.
  • the user can copy the font effect that has been presented, and then restore it to the previously entered text after copying. Then according to your needs, you can re-edit or paste it into Notepad, etc., to further perform word processing.
  • the invention also provides a computer-readable storage medium, including: the font rendering device according to any one of the above technical solutions.
  • the computer-readable storage medium according to the present invention includes the font rendering device as described in any one of the above technical solutions, and thus has all the beneficial effects of the font rendering device, which will not be described in detail.
  • FIG. 1 shows a schematic flowchart of a font rendering method according to an embodiment of the present invention
  • FIG. 2 is a schematic flowchart of a font rendering method according to another embodiment of the present invention.
  • FIG. 3 shows a schematic flowchart of a font rendering method according to yet another embodiment of the present invention.
  • FIG. 4 shows a schematic block diagram of a font rendering device according to an embodiment of the present invention
  • FIG. 5 shows a schematic flowchart of a font rendering method according to a specific embodiment of the present invention
  • FIG. 6 shows a schematic diagram of data fusion according to a specific embodiment of the present invention.
  • FIG. 7 shows a schematic flowchart of GPU rendering according to a specific embodiment of the present invention.
  • the font rendering method includes:
  • Step 102 Receive the character string to be rendered and read the font file
  • Step 104 Analyze the font file to obtain the text font information and template information corresponding to the character string;
  • Step 106 generate an animation unit according to the text font information and template information
  • Step 108 rendering the animation unit.
  • the font rendering method receives a character string that needs to be rendered, for example, receives a character string input by a user from a client, reads a font file such as a dynamic TTF (TrueTypeFont) font file, and parses the font file. Obtain the text glyph information and template information corresponding to the character string, fuse the text glyph information and template information to generate an animation unit, where the frequency of the animation can be a fixed frame interval or an irregular frame interval, and then render and render the animation unit After output, the effect is presented.
  • a font file such as a dynamic TTF (TrueTypeFont) font file
  • the corresponding template effects can be customized according to different font effects and different ranks, supporting mixed text sizes, custom text positions, custom text colors and special effects, more suitable for scene matching and graphics Combining, so as to more fully express the semantic primary and secondary, enhance the visual impact of the text, highlight the language center of gravity, highlight the artistic conception of the text, and can instantly present any personalized effect of any style according to user input, which greatly meets the user's Personalized needs.
  • the font rendering method includes:
  • Step 202 Receive the character string to be rendered and read the font file
  • Step 204 Parse the font file to obtain the text font information and template information corresponding to the character string;
  • Step 206 Perform interpolation operation on each motion attribute in the text font information and / or template information; wherein the interpolation operation includes any one or a combination of the following: scaling, rotation, displacement, color, transparency, stroke, shadow, Glow
  • Step 208 Generate an animation unit based on the text font information and template information
  • Step 210 Render the animation unit.
  • each motion attribute in the text glyph information and / or template information is interpolated to make the motion effect of the font smoother and smoother, and Realize the transformation of glyphs and templates, such as scaling, rotation, displacement, color, transparency, stroke, shadow, light emission, etc., so as to ensure the diversification, personalization, coolness of fonts, and enhance visual effects.
  • the font rendering method includes:
  • Step 302 Receive the character string to be rendered and read the font file
  • Step 304 Parse the font file to obtain the text font information and template information corresponding to the character string;
  • Step 306 Perform interpolation operation on each motion attribute in the text font information and / or template information; where the interpolation operation includes any one or a combination of the following: scaling, rotation, displacement, color, transparency, stroke, shadow, Glow
  • Step 308 generate an animation unit based on the text font information and template information
  • Step 310 Perform frame layer rendering and color filling on each frame of data of the animation unit through the GPU; among them, frame layer rendering includes: background effect drawing, single-word image effect drawing, overall image effect drawing, font effect drawing, and foreground Effect drawing; color filling methods include any one or a combination of the following: gradient, texture, solid color, animation.
  • the present invention is based on OpenGL (Open Graphics Library Open Graphics Library) technology, using GPU (Graphics Processing Unit, graphics processor) to render the animation unit
  • OpenGL is a hardware-independent software interface, in various All platforms can be transplanted, so both system-level access and application-level access can be well compatible.
  • the animation unit is sent to the GPU in the data format of each frame for frame layer rendering, and color filling is performed.
  • the frame layer data is extracted from the GPU and the frame bitmap data is formed in the memory.
  • Frame bitmap data is output to external applications for rendering.
  • the frame layer rendering process includes background effect drawing, single-word image effect drawing, overall image effect drawing, font effect drawing, and foreground effect drawing; color filling methods include but are not limited to any one or combination of gradient, texture, and solid color.
  • the present invention is based on OpenGL technology, uses GPU for font rendering and animation rendering, improves rendering speed, saves consumption of system resources, ensures system fluency, has a good fluency experience for users, and is suitable for low performance Terminal, and can obtain more diverse and cool dynamic hi-burst effects, which greatly meets the user's personalized needs for font effects, and can also install font files through the font installation interface of the computer device, further improving the user experience.
  • the text font information includes any one or a combination of the following: whole character basemap, part basemap, outline basemap; template information includes any one or a combination of the following: dynamic text layout Information, text dynamic stretching, rotation information, text dynamic color information, pendant dynamic attribute information, text overall dynamic mask information; character string consists of at least one character, the character includes any one or a combination of the following: Chinese characters, Arabic characters , English characters.
  • the text font information is composed of a single whole-character basemap or a combination of the whole-word basemap and one or more component basemaps and outline basemaps; template information includes but is not limited to one or more of the following information A: text dynamic typesetting information, text dynamic stretching, rotation information, text dynamic color information, pendant dynamic attribute information, text overall dynamic mask information; character string can be any one of Chinese characters, Arabic characters, English characters or Its combination.
  • the font typesetting method breaks the traditional text typesetting method, supports mixed text size, and more fully expresses the semantic primary and secondary; supports custom text position, enhances the visual impact of the text; supports any text color and
  • the definition of special effects can highlight the language center of gravity; it has a sense of design, and is more suitable for scene matching with graphics and text to highlight the artistic conception of words.
  • the font file includes a standard black and white character TrueType format font file, and any one or a combination of the following: a template attribute table, a glyph typesetting information table, a glyph rendering information table, a rendering information element Data table, picture animation information table, shader attribute table, picture table, shader source code table.
  • the font file includes one or more of the following in addition to the standard black-and-white TrueType format font file: template attribute table, font layout information table, font rendering information table, rendering information metadata table, and picture Animation information table, shader attribute table, picture table, and shader source code table, which can ensure the diversity, personalization, and coolness of fonts, and enhance the user's experience of personalized text expressions.
  • the rendered font effect is restored to the character string and pasted.
  • the user can copy the font effect that has been presented, and then copy it back to the previously entered text. Then according to your needs, you can re-edit or paste it into Notepad, etc., to further perform word processing.
  • the font rendering device 400 includes:
  • the memory 402 is used to store computer programs
  • the processor 404 is used to execute a computer program to: receive a character string to be rendered, read a font file; parse the font file, obtain text font information and template information corresponding to the character string; generate an animation unit according to the text font information and template information; Render the animation unit.
  • the font rendering apparatus 400 receives a character string to be rendered, for example, a character string input by a user from a client, reads a font file such as a dynamic TTF (TrueTypeFont) font file, and parses the font file. Obtain the text glyph information and template information corresponding to the character string, fuse the text glyph information and template information to generate an animation unit, where the frequency of the animation can be a fixed frame interval or an irregular frame interval, and then render and render the animation unit After output, the effect is presented.
  • a character string to be rendered for example, a character string input by a user from a client
  • a font file such as a dynamic TTF (TrueTypeFont) font file
  • TTF TrueTypeFont
  • the corresponding template effects can be customized according to different font effects and different ranks, supporting mixed text sizes, custom text positions, custom text colors and special effects, and more suitable for scene matching and graphics
  • the combination of texts can more fully express the semantic primary and secondary, enhance the visual impact of the text, highlight the language center of gravity, highlight the artistic conception of the text, and can instantly present any personalized effect of different styles according to user input, which greatly meets the user's needs during information interaction Personalized needs.
  • the processor 404 is further configured to execute a computer program to: before the step of generating the animation unit based on the text font information and template information, each movement in the text font information and / or template information Attributes are interpolated; interpolation operations include any one or a combination of the following: scaling, rotation, displacement, color, transparency, stroke, shadow, and glow.
  • each motion attribute in the text glyph information and / or template information is interpolated to make the motion effect of the font smoother and smoother, and Realize the transformation of glyphs and templates, such as scaling, rotation, displacement, color, transparency, stroke, shadow, light emission, etc., so as to ensure the diversification, personalization, coolness of fonts, and enhance visual effects.
  • the processor 404 is specifically configured to execute a computer program to: perform frame layer rendering and color fill on each frame of data of the animation unit through the GPU; wherein, the frame layer rendering includes : Background effect drawing, single-word image effect drawing, overall image effect drawing, font effect drawing, foreground effect drawing; color filling methods include any one or a combination of the following: gradient, texture, solid color, animation.
  • the present invention is based on OpenGL (Open Graphics Library Open Graphics Library) technology, using GPU (Graphics Processing Unit, graphics processor) to render the animation unit
  • OpenGL is a hardware-independent software interface, in various All platforms can be transplanted, so both system-level access and application-level access can be well compatible.
  • the animation unit is sent to the GPU in the data format of each frame for frame layer rendering, and color filling is performed.
  • the frame layer data is extracted from the GPU and the frame bitmap data is formed in the memory.
  • Frame bitmap data is output to external applications for rendering.
  • the frame layer rendering process includes background effect drawing, single-word image effect drawing, overall image effect drawing, font effect drawing, and foreground effect drawing; color filling methods include but are not limited to any one or combination of gradient, texture, and solid color.
  • the present invention is based on OpenGL technology, uses GPU for font rendering and animation rendering, improves rendering speed, saves consumption of system resources, ensures system fluency, has a good fluency experience for users, and is suitable for low performance Terminal, and can obtain more diverse and cool dynamic hi-burst effects, which greatly meets the user's personalized needs for font effects, and can also install font files through the font installation interface of the computer device, further improving the user experience.
  • the text font information includes any one or a combination of the following: whole character basemap, component basemap, outline basemap; template information includes any one or a combination of the following: text dynamic Typesetting information, text dynamic stretching and rotation information, text dynamic color information, pendant dynamic attribute information, text overall dynamic mask information;
  • the character string is composed of at least one character, and the character includes any one or a combination of the following: Chinese characters, Arabic Characters, English characters.
  • the text font information is composed of a single whole-character basemap or a combination of the whole-word basemap and one or more component basemaps and outline basemaps; template information includes but is not limited to one or more of the following information A: text dynamic typesetting information, text dynamic stretching, rotation information, text dynamic color information, pendant dynamic attribute information, text overall dynamic mask information; character string can be any one of Chinese characters, Arabic characters, English characters or Its combination.
  • the font typesetting method breaks the traditional text typesetting method, supports mixed text size, and more fully expresses the semantic primary and secondary; supports custom text position, enhances the visual impact of the text; supports any text color and
  • the definition of special effects can highlight the language center of gravity; it has a sense of design, and is more suitable for scene matching with graphics and text to highlight the artistic conception of words.
  • the font file includes a standard black-and-white font TrueType format font file, and any one or a combination of the following: a template attribute table, a glyph typesetting information table, a glyph rendering information table, and a rendering information metadata table , Picture animation information table, shader attribute table, picture table, shader source code table.
  • the font file includes one or more of the following in addition to the standard black-and-white TrueType format font file: template attribute table, font layout information table, font rendering information table, rendering information metadata table, and picture Animation information table, shader attribute table, picture table, and shader source code table, which can ensure the diversity, personalization, and coolness of fonts, and enhance the user's experience of personalized text expressions.
  • the rendered font effect upon receiving the command to copy the rendered font effect, the rendered font effect is restored to the character string and pasted.
  • the user can copy the font effect that has been presented, and then copy it back to the previously entered text. Then according to your needs, you can re-edit or paste it into Notepad, etc., to further perform word processing.
  • the font rendering method includes:
  • Step 502 read the dynamic hi-burst TTF font file
  • Step 504 Analyze the dynamic hi-burst TTF font file to obtain text font information and template information
  • Step 506 Integrate the template information with the text font information to form an animation unit
  • Step 508 Send the animation unit to the GPU in the data format of each frame for frame layer rendering
  • Step 510 Extract frame layer data from the GPU to form frame bitmap data in memory
  • Step 512 Output the frame bitmap data to an external application for dynamic hi-burst effect presentation.
  • the animation unit is formed by data fusion of character font information and template information.
  • the schematic diagram of data fusion is shown in FIG. 6.
  • the frequency of animation can be fixed frame interval or irregular frame interval.
  • Dynamic hi-burst TTF font file includes standard black and white font TrueType format font files, and one or more of the following: template attribute table, font layout information table, font rendering information table, rendering information metadata table, picture animation information table, coloring Attribute table, picture table, shader source code table, etc.
  • the text font information is composed of a single whole-character basemap or a combination of the whole-word basemap and one or more component basemaps and outline basemaps; template information includes any one or a combination of the following: dynamic text layout information, dynamic text pull L, rotation information, text dynamic color information, pendant dynamic attribute information, text overall dynamic mask information.
  • interpolation is performed on each moving object attribute, including but not limited to scaling, rotation, displacement, color, transparency, stroke, shadow, light emission, and so on.
  • the dynamic hi-burst effect when the command to copy the dynamic hi-burst effect is received, the dynamic hi-burst effect is restored to the previously entered text.
  • FIG. 7 shows the process of rendering the frame layer of each frame of data of the animation unit by the GPU, which specifically includes the following steps:
  • Step 702 drawing data processing
  • Step 704 background effect drawing
  • Step 710 drawing a whole-character image
  • step 712 the foreground effect is drawn.
  • the font rendering method provided by the embodiment of the present invention breaks the traditional typesetting mode from left to right, top to bottom, line spacing, and column spacing, supports mixed text size, and more fully expresses the semantic primary and secondary; supports custom text Position, enhance the visual impact of the text; support the definition of any text color and special effects, highlight the center of gravity of the language; have a sense of design that is more suitable for scene matching and combination of graphics and text, and highlight the artistic conception of the text; at the same time, the user enters the immediate rendering effect, and the user can express according to their own wishes Enter any text in the content, you can get a dynamic hi-burst effect according to the template corresponding to the number of texts; users can copy the dynamic hi-burst effect that has been presented, paste it back to the previously entered text, and then perform it again according to your needs Edit or paste into Notepad, etc.
  • GPU rendering based on OpenGL technology improves the rendering speed, saves the consumption of system resources, ensures the fluency of the system, has a good fluency experience for users, and is suitable for low-performance terminals, further improving the user's Experience.
  • An embodiment of the present invention also provides a computer-readable storage medium, including: the font rendering device according to any one of the foregoing embodiments.
  • the computer-readable storage medium of the embodiment of the present invention includes the font rendering device as described in any one of the foregoing embodiments, and thus has all the beneficial effects of the font rendering device, which will not be described in detail.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Human Computer Interaction (AREA)
  • Controls And Circuits For Display Device (AREA)
  • Processing Or Creating Images (AREA)
  • Document Processing Apparatus (AREA)

Abstract

一种字体渲染方法、装置及计算机可读存储介质。其中,字体渲染方法,包括:接收需要渲染的字符串,读取字体文件(102);解析字体文件,获得字符串对应的文字字形信息与模板信息(104);根据文字字形信息与模板信息生成动画单元(106);对动画单元进行渲染(108)。通过上述字体渲染方法,可以根据不同的字体效果,不同的行列来自定义对应的模板效果,支持文字大小混排、自定义文字位置、自定义文字颜色与特效、更适合场景搭配与图文结合,从而更充分地表达语义主次,增强文字视觉冲击力,突显语言重心,彰显文字意境,并且可根据用户输入即时呈现任意不同风格的个性化效果,极大满足了用户在信息交互时的个性化需求。

Description

字体渲染方法、装置及计算机可读存储介质 技术领域
本发明涉及文字处理技术领域,具体而言,涉及一种字体渲染方法,一种字体渲染装置,及一种计算机可读存储介质。
背景技术
传统的文字排版方式就是从左至右、从上到下、行间距、列间距固定模式,不够有创意、页面效果过于单调;表情展示字体只能是固定字,而且需要前期制作好,不能根据用户输入即时呈现效果;复制图片表情的时候无法对提取出汉字;此外,市面上的绘制方式都是通过上层或者CPU(Central Processing Unit,中央处理器)的方式来绘制,由于运算量大,不适合在低性能终端设备上使用,也做不出来效果比较酷炫的效果。
发明内容
本发明旨在至少解决现有技术或相关技术中存在的技术问题之一。
为此,本发明的一方面在于提出了一种字体渲染方法。
本发明的另一方面在于提出了一种字体渲染装置。
本发明的再一方面在于提出了一种计算机可读存储介质。
有鉴于此,本发明提出了一种字体渲染方法,包括:接收需要渲染的字符串,读取字体文件;解析字体文件,获得字符串对应的文字字形信息与模板信息;根据文字字形信息与模板信息生成动画单元;对动画单元进行渲染。
根据本发明的字体渲染方法,接收需要渲染的字符串,例如从客户端接收用户输入的字符串,读取字体文件如动态嗨爆TTF(TrueTypeFont)字库文件,对该字体文件进行解析,获得字符串对应的文字字形信息与模板信息,将文字字形信息与模板信息进行融合,生成动画单元,其中动画的频率可以是固定的帧间隔或者不规律帧间隔,再对动画单元进行渲染,渲染后输出进行效果呈现。通过本发明的字体渲染方法,可以根据不同的字体效果,不同的行列来自定义对应的模板效果,支持文字大小混排、自 定义文字位置、自定义文字颜色与特效、更适合场景搭配与图文结合,从而更充分地表达语义主次,增强文字视觉冲击力,突显语言重心,彰显文字意境,并且可根据用户输入即时呈现任意不同风格的个性化效果,极大满足了用户在信息交互时的个性化需求。
在上述技术方案中,优选地,在根据文字字形信息与模板信息生成动画单元的步骤之前,还包括:对文字字形信息和/或模板信息中的每个运动属性进行插值运算;插值运算包括以下任一项或其组合:缩放,旋转,位移,颜色,透明度,描边,阴影,发光。
在该技术方案中,在对文字字形信息与模板信息进行数据融合之前,对文字字形信息和/或模板信息中的每个运动属性进行了插值运算,使字体的运动效果更流畅、平滑,并实现对字形与模板的变换,如缩放、旋转、位移、颜色、透明度、描边、阴影、发光等,从而保证字体的多样化、个性化、酷炫化,并增强视觉效果。
在上述任一技术方案中,优选地,对动画单元进行渲染的步骤,具体包括:通过GPU对动画单元的每帧数据进行帧图层渲染,并进行颜色填充;其中,帧图层渲染包括:背景效果绘制、单字图像效果绘制、整体图像效果绘制、字体效果绘制、前景效果绘制;颜色填充的方式包括以下任一项或其组合:渐变、纹理、纯色、动画。
在该技术方案中,本发明基于OpenGL(Open Graphics Library开放图形库)技术,采用GPU(Graphics Processing Unit,图形处理器)对动画单元进行渲染,OpenGL是一个与硬件无关的软件接口,在各种平台之间都能进行移植,因此,不管是系统级的接入还是应用级的接入都能很好的进行兼容。具体而言,将动画单元以每帧的数据格式送抵至GPU进行帧图层渲染,同时进行颜色填充,渲染完成后,从GPU中提取帧图层数据,在内存形成帧位图数据,将帧位图数据输出至外部应用进行效果呈现。帧图层渲染过程包括背景效果绘制、单字图像效果绘制、整体图像效果绘制、字体效果绘制、前景效果绘制;颜色填充的方式包括但不限于渐变、纹理、纯色、动画中的任一项或其组合。本发明基于OpenGL技术,利用了GPU进行字体渲染和动画渲染,提高了渲染速度,节省了系统资源的消耗,保证了系统的流畅性,对用户有很好的流畅度体验,同时适用于低性能终端, 并且能够获得更多样、酷炫的动态嗨爆效果,极大满足用户对字体效果的个性化需求,还可通过计算机设备的字体安装接口来安装字体文件,进一步提高了用户的体验。
在上述任一技术方案中,优选地,文字字形信息包括以下任一项或其组合:整字底图、部件底图、轮廓底图;模板信息包括以下任一项或其组合:文字动态排版信息,文字动态拉伸、旋转信息,文字动态颜色信息,挂件动态属性信息,文字整体动态遮罩信息;字符串由至少一个字符组成,字符包括以下任一项或其组合:中文字符、阿拉伯字符、英文字符。
在该技术方案中,文字字形信息由单独的整字底图或者整字底图与一个或者多个部件底图、轮廓底图的组合组成;模板信息包括但不限于以下信息中的一个或者多个:文字动态排版信息,文字动态拉伸、旋转信息,文字动态颜色信息,挂件动态属性信息,文字整体动态遮罩信息;字符串可以是中文字符、阿拉伯字符、英文字符中的任一项或其组合。通过本发明的字体渲染方法,字形排版方式打破了传统的文字排版方式,支持文字大小混排,更充分地表达语义主次;支持自定义文字位置,增强文字视觉冲击力;支持任意文字颜色与特效的定义,能突显语言重心;具有设计感,更适合场景搭配与图文结合,彰显文字意境。
在上述任一技术方案中,优选地,字体文件包括标准黑白字TrueType格式字体文件,以及以下任一项或其组合:模板属性表、字形排版信息表、字形渲染信息表、渲染信息元数据表、图片动画信息表、着色器属性表、图片表、着色器源码表。
在该技术方案中,字体文件除了包括标准黑白字TrueType格式字体文件外,还包括以下一种或多种组合:模板属性表、字形排版信息表、字形渲染信息表、渲染信息元数据表、图片动画信息表、着色器属性表、图片表、着色器源码表,由此可以确保字体的多样性、个性化、酷炫化,提升用户对个性化文字表情的体验。
本发明还提出了一种字体渲染装置,包括:存储器,用于存储计算机程序;处理器,用于执行计算机程序以:接收需要渲染的字符串,读取字体文件;解析字体文件,获得字符串对应的文字字形信息与模板信息;根据文字字形信息与模板信息生成动画单元;对动画单元进行渲染。
根据本发明的字体渲染装置,接收需要渲染的字符串,例如从客户端接收用户输入的字符串,读取字体文件如动态嗨爆TTF(TrueTypeFont)字库文件,对该字体文件进行解析,获得字符串对应的文字字形信息与模板信息,将文字字形信息与模板信息进行融合,生成动画单元,其中动画的频率可以是固定的帧间隔或者不规律帧间隔,再对动画单元进行渲染,渲染后输出进行效果呈现。通过本发明的字体渲染装置,可以根据不同的字体效果,不同的行列来自定义对应的模板效果,支持文字大小混排、自定义文字位置、自定义文字颜色与特效、更适合场景搭配与图文结合,从而更充分地表达语义主次,增强文字视觉冲击力,突显语言重心,彰显文字意境,并且可根据用户输入即时呈现任意不同风格的个性化效果,极大满足了用户在信息交互时的个性化需求。
在上述技术方案中,优选地,处理器,还用于执行计算机程序以:在根据文字字形信息与模板信息生成动画单元的步骤之前,对文字字形信息和/或模板信息中的每个运动属性进行插值运算;插值运算包括以下任一项或其组合:缩放,旋转,位移,颜色,透明度,描边,阴影,发光。
在该技术方案中,在对文字字形信息与模板信息进行数据融合之前,对文字字形信息和/或模板信息中的每个运动属性进行了插值运算,使字体的运动效果更流畅、平滑,并实现对字形与模板的变换,如缩放、旋转、位移、颜色、透明度、描边、阴影、发光等,从而保证字体的多样化、个性化、酷炫化,并增强视觉效果。
在上述任一技术方案中,优选地,处理器,具体用于执行计算机程序以:通过GPU对动画单元的每帧数据进行帧图层渲染,并进行颜色填充;其中,帧图层渲染包括:背景效果绘制、单字图像效果绘制、整体图像效果绘制、字体效果绘制、前景效果绘制;颜色填充的方式包括以下任一项或其组合:渐变、纹理、纯色、动画。
在该技术方案中,本发明基于OpenGL(Open Graphics Library开放图形库)技术,采用GPU(Graphics Processing Unit,图形处理器)对动画单元进行渲染,OpenGL是一个与硬件无关的软件接口,在各种平台之间都能进行移植,因此,不管是系统级的接入还是应用级的接入都能很好的进行兼容。具体而言,将动画单元以每帧的数据格式送抵至GPU进行帧 图层渲染,同时进行颜色填充,渲染完成后,从GPU中提取帧图层数据,在内存形成帧位图数据,将帧位图数据输出至外部应用进行效果呈现。帧图层渲染过程包括背景效果绘制、单字图像效果绘制、整体图像效果绘制、字体效果绘制、前景效果绘制;颜色填充的方式包括但不限于渐变、纹理、纯色中的任一项或其组合。本发明基于OpenGL技术,利用了GPU进行字体渲染和动画渲染,提高了渲染速度,节省了系统资源的消耗,保证了系统的流畅性,对用户有很好的流畅度体验,同时适用于低性能终端,并且能够获得更多样、酷炫的动态嗨爆效果,极大满足用户对字体效果的个性化需求,还可通过计算机设备的字体安装接口来安装字体文件,进一步提高了用户的体验。
在上述任一技术方案中,优选地,文字字形信息包括以下任一项或其组合:整字底图、部件底图、轮廓底图;模板信息包括以下任一项或其组合:文字动态排版信息,文字动态拉伸、旋转信息,文字动态颜色信息,挂件动态属性信息,文字整体动态遮罩信息;字符串由至少一个字符组成,字符包括以下任一项或其组合:中文字符、阿拉伯字符、英文字符。
在该技术方案中,文字字形信息由单独的整字底图或者整字底图与一个或者多个部件底图、轮廓底图的组合组成;模板信息包括但不限于以下信息中的一个或者多个:文字动态排版信息,文字动态拉伸、旋转信息,文字动态颜色信息,挂件动态属性信息,文字整体动态遮罩信息;字符串可以是中文字符、阿拉伯字符、英文字符中的任一项或其组合。通过本发明的字体渲染方法,字形排版方式打破了传统的文字排版方式,支持文字大小混排,更充分地表达语义主次;支持自定义文字位置,增强文字视觉冲击力;支持任意文字颜色与特效的定义,能突显语言重心;具有设计感,更适合场景搭配与图文结合,彰显文字意境。
在上述任一技术方案中,优选地,字体文件包括标准黑白字TrueType格式字体文件,以及以下任一项或其组合:模板属性表、字形排版信息表、字形渲染信息表、渲染信息元数据表、图片动画信息表、着色器属性表、图片表、着色器源码表。
在该技术方案中,字体文件除了包括标准黑白字TrueType格式字体文件外,还包括以下一种或多种组合模板属性表、字形排版信息表、字形 渲染信息表、渲染信息元数据表、图片动画信息表、着色器属性表、图片表、着色器源码表,由此可以确保字体的多样性、个性化、酷炫化,提升用户对个性化文字表情的体验。
在上述任一技术方案中,优选地,在接收到复制渲染后的字体效果的命令时,将所述渲染后的字体效果还原成所述字符串并进行粘贴。
在该技术方案中,用户可以复制已经呈现出来的字体效果,复制后还原成之前输入的文字。然后根据自己的需要可以重新进行编辑或者粘贴到记事本等,进一步进行文字处理。
本发明还提出了一种计算机可读存储介质,包括:如上述技术方案中任一项的字体渲染装置。
根据本发明的计算机可读存储介质,包括如上述技术方案中任一项的字体渲染装置,因而具有该字体渲染装置全部的有益效果,不再赘述。
本发明的附加方面和优点将在下面的描述部分中变得明显,或通过本发明的实践了解到。
附图说明
本发明的上述和/或附加的方面和优点从结合下面附图对实施例的描述中将变得明显和容易理解,其中:
图1示出了根据本发明的一个实施例的字体渲染方法的流程示意图;
图2示出了根据本发明的另一个实施例的字体渲染方法的流程示意图;
图3示出了根据本发明的再一个实施例的字体渲染方法的流程示意图;
图4示出了根据本发明的一个实施例的字体渲染装置的示意框图;
图5示出了根据本发明的一个具体实施例的字体渲染方法的流程示意图;
图6示出了根据本发明的一个具体实施例的数据融合的示意图;
图7示出了根据本发明的一个具体实施例的GPU渲染的流程示意图。
具体实施方式
为了能够更清楚地理解本发明的上述目的、特征和优点,下面结合附图和具体实施方式对本发明进行进一步的详细描述。需要说明的是,在不冲突的情况下,本申请的实施例及实施例中的特征可以相互组合。
在下面的描述中阐述了很多具体细节以便于充分理解本发明,但是,本发明还可以采用其他不同于在此描述的其他方式来实施,因此,本发明的保护范围并不受下面公开的具体实施例的限制。
如图1所示,根据本发明的一个实施例的字体渲染方法的流程示意图。其中,该字体渲染方法,包括:
步骤102,接收需要渲染的字符串,读取字体文件;
步骤104,解析字体文件,获得字符串对应的的文字字形信息与模板信息;
步骤106,根据文字字形信息与模板信息生成动画单元;
步骤108,对动画单元进行渲染。
本发明实施例提供的字体渲染方法,接收需要渲染的字符串,例如从客户端接收用户输入的字符串,读取字体文件如动态嗨爆TTF(TrueTypeFont)字库文件,对该字体文件进行解析,获得字符串对应的文字字形信息与模板信息,将文字字形信息与模板信息进行融合,生成动画单元,其中动画的频率可以是固定的帧间隔或者不规律帧间隔,再对动画单元进行渲染,渲染后输出进行效果呈现。通过本发明的字体渲染方法,可以根据不同的字体效果,不同的行列来自定义对应的模板效果,支持文字大小混排、自定义文字位置、自定义文字颜色与特效、更适合场景搭配与图文结合,从而更充分地表达语义主次,增强文字视觉冲击力,突显语言重心,彰显文字意境,并且可根据用户输入即时呈现任意不同风格的个性化效果,极大满足了用户在信息交互时的个性化需求。
如图2所示,根据本发明的另一个实施例的字体渲染方法的流程示意图。其中,该字体渲染方法,包括:
步骤202,接收需要渲染的字符串,读取字体文件;
步骤204,解析字体文件,获得字符串对应的文字字形信息与模板信息;
步骤206,对文字字形信息和/或模板信息中的每个运动属性进行插值 运算;其中,插值运算包括以下任一项或其组合:缩放,旋转,位移,颜色,透明度,描边,阴影,发光;
步骤208,根据文字字形信息与模板信息生成动画单元;
步骤210,对动画单元进行渲染。
在该实施例中,在对文字字形信息与模板信息进行数据融合之前,对文字字形信息和/或模板信息中的每个运动属性进行了插值运算,使字体的运动效果更流畅、平滑,并实现对字形与模板的变换,如缩放、旋转、位移、颜色、透明度、描边、阴影、发光等,从而保证字体的多样化、个性化、酷炫化,并增强视觉效果。
如图3所示,根据本发明的再一个实施例的字体渲染方法的流程示意图。其中,该字体渲染方法,包括:
步骤302,接收需要渲染的字符串,读取字体文件;
步骤304,解析字体文件,获得字符串对应的文字字形信息与模板信息;
步骤306,对文字字形信息和/或模板信息中的每个运动属性进行插值运算;其中,插值运算包括以下任一项或其组合:缩放,旋转,位移,颜色,透明度,描边,阴影,发光;
步骤308,根据文字字形信息与模板信息生成动画单元;
步骤310,通过GPU对动画单元的每帧数据进行帧图层渲染,并进行颜色填充;其中,帧图层渲染包括:背景效果绘制、单字图像效果绘制、整体图像效果绘制、字体效果绘制、前景效果绘制;颜色填充的方式包括以下任一项或其组合:渐变、纹理、纯色、动画。
在该实施例中,本发明基于OpenGL(Open Graphics Library开放图形库)技术,采用GPU(Graphics Processing Unit,图形处理器)对动画单元进行渲染,OpenGL是一个与硬件无关的软件接口,在各种平台之间都能进行移植,因此,不管是系统级的接入还是应用级的接入都能很好的进行兼容。具体而言,将动画单元以每帧的数据格式送抵至GPU进行帧图层渲染,同时进行颜色填充,渲染完成后,从GPU中提取帧图层数据,在内存形成帧位图数据,将帧位图数据输出至外部应用进行效果呈现。帧图层渲染过程包括背景效果绘制、单字图像效果绘制、整体图像效果绘制、 字体效果绘制、前景效果绘制;颜色填充的方式包括但不限于渐变、纹理、纯色中的任一项或其组合。本发明基于OpenGL技术,利用了GPU进行字体渲染和动画渲染,提高了渲染速度,节省了系统资源的消耗,保证了系统的流畅性,对用户有很好的流畅度体验,同时适用于低性能终端,并且能够获得更多样、酷炫的动态嗨爆效果,极大满足用户对字体效果的个性化需求,还可通过计算机设备的字体安装接口来安装字体文件,进一步提高了用户的体验。
在上述任一实施例中,优选地,文字字形信息包括以下任一项或其组合:整字底图、部件底图、轮廓底图;模板信息包括以下任一项或其组合:文字动态排版信息,文字动态拉伸、旋转信息,文字动态颜色信息,挂件动态属性信息,文字整体动态遮罩信息;字符串由至少一个字符组成,字符包括以下任一项或其组合:中文字符、阿拉伯字符、英文字符。
在该实施例中,文字字形信息由单独的整字底图或者整字底图与一个或者多个部件底图、轮廓底图的组合组成;模板信息包括但不限于以下信息中的一个或者多个:文字动态排版信息,文字动态拉伸、旋转信息,文字动态颜色信息,挂件动态属性信息,文字整体动态遮罩信息;字符串可以是中文字符、阿拉伯字符、英文字符中的任一项或其组合。通过本发明的字体渲染方法,字形排版方式打破了传统的文字排版方式,支持文字大小混排,更充分地表达语义主次;支持自定义文字位置,增强文字视觉冲击力;支持任意文字颜色与特效的定义,能突显语言重心;具有设计感,更适合场景搭配与图文结合,彰显文字意境。
在上述任一实施例中,优选地,所述字体文件包括标准黑白字TrueType格式字体文件,以及以下任一项或其组合:模板属性表、字形排版信息表、字形渲染信息表、渲染信息元数据表、图片动画信息表、着色器属性表、图片表、着色器源码表。
在该实施例中,字体文件除了包括标准黑白字TrueType格式字体文件外,还包括以下一种或多种组合:模板属性表、字形排版信息表、字形渲染信息表、渲染信息元数据表、图片动画信息表、着色器属性表、图片表、着色器源码表,由此可以确保字体的多样性、个性化、酷炫化,提升用户对个性化文字表情的体验。
在上述任一实施例中,优选地,在接收到复制渲染后的字体效果的命令时,将所述渲染后的字体效果还原成所述字符串并进行粘贴。
在该实施例中,用户可以复制已经呈现出来的字体效果,复制后还原成之前输入的文字。然后根据自己的需要可以重新进行编辑或者粘贴到记事本等,进一步进行文字处理。
如图4所示,根据本发明的一个实施例的字体渲染装置的示意框图。其中,该字体渲染装置400,包括:
存储器402,用于存储计算机程序;
处理器404,用于执行计算机程序以:接收需要渲染的字符串,读取字体文件;解析字体文件,获得字符串对应的文字字形信息与模板信息;根据文字字形信息与模板信息生成动画单元;对动画单元进行渲染。
本发明实施例的字体渲染装置400,接收需要渲染的字符串,例如从客户端接收用户输入的字符串,读取字体文件如动态嗨爆TTF(TrueTypeFont)字库文件,对该字体文件进行解析,获得字符串对应的文字字形信息与模板信息,将文字字形信息与模板信息进行融合,生成动画单元,其中动画的频率可以是固定的帧间隔或者不规律帧间隔,再对动画单元进行渲染,渲染后输出进行效果呈现。通过本发明的字体渲染装置400,可以根据不同的字体效果,不同的行列来自定义对应的模板效果,支持文字大小混排、自定义文字位置、自定义文字颜色与特效、更适合场景搭配与图文结合,从而更充分地表达语义主次,增强文字视觉冲击力,突显语言重心,彰显文字意境,并且可根据用户输入即时呈现任意不同风格的个性化效果,极大满足了用户在信息交互时的个性化需求。
在上述实施例中,优选地,处理器404,还用于执行计算机程序以:在根据文字字形信息与模板信息生成动画单元的步骤之前,对文字字形信息和/或模板信息中的每个运动属性进行插值运算;插值运算包括以下任一项或其组合:缩放,旋转,位移,颜色,透明度,描边,阴影,发光。
在该实施例中,在对文字字形信息与模板信息进行数据融合之前,对文字字形信息和/或模板信息中的每个运动属性进行了插值运算,使字体的运动效果更流畅、平滑,并实现对字形与模板的变换,如缩放、旋转、位移、颜色、透明度、描边、阴影、发光等,从而保证字体的多样化、个 性化、酷炫化,并增强视觉效果。
在上述任一实施例中,优选地,处理器404,具体用于执行计算机程序以:通过GPU对动画单元的每帧数据进行帧图层渲染,并进行颜色填充;其中,帧图层渲染包括:背景效果绘制、单字图像效果绘制、整体图像效果绘制、字体效果绘制、前景效果绘制;颜色填充的方式包括以下任一项或其组合:渐变、纹理、纯色、动画。
在该实施例中,本发明基于OpenGL(Open Graphics Library开放图形库)技术,采用GPU(Graphics Processing Unit,图形处理器)对动画单元进行渲染,OpenGL是一个与硬件无关的软件接口,在各种平台之间都能进行移植,因此,不管是系统级的接入还是应用级的接入都能很好的进行兼容。具体而言,将动画单元以每帧的数据格式送抵至GPU进行帧图层渲染,同时进行颜色填充,渲染完成后,从GPU中提取帧图层数据,在内存形成帧位图数据,将帧位图数据输出至外部应用进行效果呈现。帧图层渲染过程包括背景效果绘制、单字图像效果绘制、整体图像效果绘制、字体效果绘制、前景效果绘制;颜色填充的方式包括但不限于渐变、纹理、纯色中的任一项或其组合。本发明基于OpenGL技术,利用了GPU进行字体渲染和动画渲染,提高了渲染速度,节省了系统资源的消耗,保证了系统的流畅性,对用户有很好的流畅度体验,同时适用于低性能终端,并且能够获得更多样、酷炫的动态嗨爆效果,极大满足用户对字体效果的个性化需求,还可通过计算机设备的字体安装接口来安装字体文件,进一步提高了用户的体验。
在本发明的一个实施例中,优选地,文字字形信息包括以下任一项或其组合:整字底图、部件底图、轮廓底图;模板信息包括以下任一项或其组合:文字动态排版信息,文字动态拉伸、旋转信息,文字动态颜色信息,挂件动态属性信息,文字整体动态遮罩信息;字符串由至少一个字符组成,字符包括以下任一项或其组合:中文字符、阿拉伯字符、英文字符。
在该实施例中,文字字形信息由单独的整字底图或者整字底图与一个或者多个部件底图、轮廓底图的组合组成;模板信息包括但不限于以下信息中的一个或者多个:文字动态排版信息,文字动态拉伸、旋转信息,文字动态颜色信息,挂件动态属性信息,文字整体动态遮罩信息;字符串可 以是中文字符、阿拉伯字符、英文字符中的任一项或其组合。通过本发明的字体渲染方法,字形排版方式打破了传统的文字排版方式,支持文字大小混排,更充分地表达语义主次;支持自定义文字位置,增强文字视觉冲击力;支持任意文字颜色与特效的定义,能突显语言重心;具有设计感,更适合场景搭配与图文结合,彰显文字意境。
在本发明的一个实施例中,所述字体文件包括标准黑白字TrueType格式字体文件,以及以下任一项或其组合:模板属性表、字形排版信息表、字形渲染信息表、渲染信息元数据表、图片动画信息表、着色器属性表、图片表、着色器源码表。
在该实施例中,字体文件除了包括标准黑白字TrueType格式字体文件外,还包括以下一种或多种组合:模板属性表、字形排版信息表、字形渲染信息表、渲染信息元数据表、图片动画信息表、着色器属性表、图片表、着色器源码表,由此可以确保字体的多样性、个性化、酷炫化,提升用户对个性化文字表情的体验。
在本发明的一个实施例中,在接收到复制渲染后的字体效果的命令时,将所述渲染后的字体效果还原成所述字符串并进行粘贴。
在该实施例中,用户可以复制已经呈现出来的字体效果,复制后还原成之前输入的文字。然后根据自己的需要可以重新进行编辑或者粘贴到记事本等,进一步进行文字处理。
如图5所示,根据本发明的一个具体实施例的字体渲染方法的流程示意图。其中,该字体渲染方法,包括:
步骤502,读取动态嗨爆TTF字库文件;
步骤504,解析动态嗨爆TTF字库文件,获取文字字形信息与模板信息;
步骤506,将模板信息与文字字形信息进行融合,形成动画单元;
步骤508,将动画单元以每帧的数据格式送抵GPU进行帧图层渲染;
步骤510,从GPU提取帧图层数据在内存形成帧位图数据;
步骤512,将帧位图数据输出至外部应用进行动态嗨爆效果呈现。
在本实施例中,动画单元是由文字字形信息与模板信息进行数据融合而形成的,数据融合示意图如图6所示。其中动画的频率是可以固定的帧 间隔或者不规律帧间隔。
动态嗨爆TTF字库文件包括标准黑白字TrueType格式字体文件,以及以下一种或多种组合:模板属性表、字形排版信息表、字形渲染信息表、渲染信息元数据表、图片动画信息表、着色器属性表、图片表、着色器源码表等。
文字字形信息是由单独的整字底图或者整字底图与一个或者多个部件底图、轮廓底图的组合;模板信息包括以下任一项或其组合:文字动态排版信息、文字动态拉升、旋转信息、文字动态颜色信息、挂件动态属性信息、文字整体动态遮罩信息。
在本发明的一个具体实施例中,在进行数据融合之前,对每个运动对象属性进行了插值运算,包括不限于缩放,旋转,位移、颜色、透明度、描边、阴影、发光等。
在本发明的一个具体实施例中,在接收到复制动态嗨爆效果的命令时,将动态嗨爆效果还原成之前输入的文字。
图7示出了GPU对动画单元的每帧数据进行帧图层渲染的过程,具体包括如下步骤:
步骤702,绘制数据处理;
步骤704,背景效果绘制;
步骤706,字体效果绘制;
步骤708,单字图像绘制;
步骤710,整字图像绘制;
步骤712,前景效果绘制。
本发明实施例提供的字体渲染方法,打破了传统从左至右,从上到下,行间距,列间距固定排版模式,支持文字大小混排,更充分地表达语义主次;支持自定义文字位置,增强文字视觉冲击力;支持任意文字颜色与特效的定义,突显语言重心;具有设计感更适合场景搭配与图文结合,彰显文字意境;同时用户输入即时呈现效果,用户可根据自己想表达的内容任意输入文字,就可以得到根据文字数量对应的模板生成一个动态嗨爆效果;用户可以复制已经呈现出来的动态嗨爆效果,粘贴后还原成之前输入的文字,然后根据自己的需要重新进行编辑或者粘贴到记事本等,进一步 进行文字处理。此外,基于OpenGL技术的GPU渲染,提高了渲染速度,节省了系统资源的消耗,保证了系统的流畅性,对用户有很好的流畅度体验,并适用于低性能终端,进一步提高了用户的体验。
本发明实施例还提供了一种计算机可读存储介质,包括:如上述实施例中任一项的字体渲染装置。
本发明实施例的计算机可读存储介质,包括如上述实施例中任一项的字体渲染装置,因而具有该字体渲染装置全部的有益效果,不再赘述。
以上所述仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。

Claims (11)

  1. 一种字体渲染方法,其特征在于,包括:
    接收需要渲染的字符串,读取字体文件;
    解析所述字体文件,获得所述字符串对应的文字字形信息与模板信息;
    根据所述文字字形信息与所述模板信息生成动画单元;
    对所述动画单元进行渲染。
  2. 根据权利要求1所述的字体渲染方法,其特征在于,在根据所述文字字形信息与所述模板信息生成动画单元的步骤之前,还包括:
    对所述文字字形信息和/或所述模板信息中的每个运动属性进行插值运算;
    所述插值运算包括以下任一项或其组合:缩放,旋转,位移,颜色,透明度,描边,阴影,发光。
  3. 根据权利要求1所述的字体渲染方法,其特征在于,对所述动画文件进行渲染的步骤,具体包括:
    通过GPU对所述动画单元的每帧数据进行帧图层渲染,并进行颜色填充;其中,所述帧图层渲染包括:背景效果绘制、单字图像效果绘制、整体图像效果绘制、字体效果绘制、前景效果绘制;
    所述颜色填充的方式包括以下任一项或其组合:渐变、纹理、纯色、动画。
  4. 根据权利要求1至3中任一项所述的字体渲染方法,其特征在于,
    所述文字字形信息包括以下任一项或其组合:整字底图、部件底图、轮廓底图;
    所述模板信息包括以下任一项或其组合:文字动态排版信息,文字动态拉伸、旋转信息,文字动态颜色信息,挂件动态属性信息,文字整体动态遮罩信息;
    所述字符串由至少一个字符组成,所述字符包括以下任一项或其组合:中文字符、阿拉伯字符、英文字符。
  5. 根据权利要求1至3中任一项所述的字体渲染方法,其特征在于,
    所述字体文件包括标准黑白字TrueType格式字体文件,以及以下任 一项或其组合:模板属性表、字形排版信息表、字形渲染信息表、渲染信息元数据表、图片动画信息表、着色器属性表、图片表、着色器源码表。
  6. 一种字体渲染装置,其特征在于,包括:
    存储器,用于存储计算机程序;
    处理器,用于执行所述计算机程序以:接收需要渲染的字符串,读取字体文件;解析所述字体文件,获得所述字符串对应的的文字字形信息与模板信息;根据所述文字字形信息与所述模板信息生成动画单元;对所述动画单元进行渲染。
  7. 根据权利要求6所述的字体渲染装置,其特征在于,所述处理器,还用于执行所述计算机程序以:
    在根据所述文字字形信息与所述模板信息生成动画文件的步骤之前,对所述文字字形信息和/或所述模板信息中的每个运动属性进行插值运算;所述插值运算包括以下任一项或其组合:缩放,旋转,位移,颜色,透明度,描边,阴影,发光。
  8. 根据权利要求6所述的字体渲染装置,其特征在于,所述处理器,具体用于执行所述计算机程序以:
    通过GPU对所述动画单元的每帧数据进行帧图层渲染,并并进行颜色填充;其中,所述帧图层渲染包括:背景效果绘制、单字图像效果绘制、整体图像效果绘制、字体效果绘制、前景效果绘制;
    所述颜色填充的方式包括以下任一项或其组合:渐变、纹理、纯色、动画。
  9. 根据权利要求6至8中任一项所述的字体渲染装置,其特征在于,
    所述文字字形信息包括以下任一项或其组合:整字底图、部件底图、轮廓底图;
    所述模板信息包括以下任一项或其组合:文字动态排版信息,文字动态拉伸、旋转信息,文字动态颜色信息,文字大小信息,挂件动态属性信息,文字整体动态遮罩信息;
    所述字符串由至少一个字符组成,所述字符包括以下任一项或其组合:中文字符、阿拉伯字符、英文字符。
  10. 根据权利要求7至9中任一项所述的字体渲染装置,其特征在于,
    所述字体文件包括标准黑白字TrueType格式字体文件,以及以下任一项或其组合:模板属性表、字形排版信息表、字形渲染信息表、渲染信息元数据表、图片动画信息表、着色器属性表、图片表、着色器源码表。
  11. 一种计算机可读存储介质,其特征在于,包括:
    如权利要求6至10中任一项的所述字体渲染装置。
PCT/CN2018/121554 2018-11-23 2018-12-17 字体渲染方法、装置及计算机可读存储介质 WO2020103245A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
KR1020217011581A KR102523843B1 (ko) 2018-11-23 2018-12-17 폰트 렌더링 방법, 장치 및 컴퓨터 판독 가능 저장매체
JP2021529688A JP7210733B2 (ja) 2018-11-23 2018-12-17 フォントレンダリング方法、装置及びコンピュータ可読記憶媒体
US17/238,630 US11507727B2 (en) 2018-11-23 2021-04-23 Font rendering method and apparatus, and computer-readable storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811405468.3 2018-11-23
CN201811405468.3A CN111221597A (zh) 2018-11-23 2018-11-23 字体渲染方法、装置及计算机可读存储介质

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/238,630 Continuation US11507727B2 (en) 2018-11-23 2021-04-23 Font rendering method and apparatus, and computer-readable storage medium

Publications (1)

Publication Number Publication Date
WO2020103245A1 true WO2020103245A1 (zh) 2020-05-28

Family

ID=70773620

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/121554 WO2020103245A1 (zh) 2018-11-23 2018-12-17 字体渲染方法、装置及计算机可读存储介质

Country Status (5)

Country Link
US (1) US11507727B2 (zh)
JP (1) JP7210733B2 (zh)
KR (1) KR102523843B1 (zh)
CN (1) CN111221597A (zh)
WO (1) WO2020103245A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112434488A (zh) * 2020-10-23 2021-03-02 合肥联宝信息技术有限公司 一种自动打标方法、设备以及计算机可读存储介质
CN113011130A (zh) * 2021-02-20 2021-06-22 安徽文香科技有限公司 一种字符动画编辑方法、装置、电子设备及存储介质
CN113298741A (zh) * 2020-11-13 2021-08-24 阿里巴巴集团控股有限公司 图片合成方法、装置及电子设备
CN113392268A (zh) * 2021-03-31 2021-09-14 百果园技术(新加坡)有限公司 一种特效文本渲染方法、装置、电子设备及存储介质

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112307715A (zh) * 2020-11-13 2021-02-02 深圳市前海手绘科技文化有限公司 一种基于文字排版的手绘素材制作方法与装置
CN114598893B (zh) * 2020-11-19 2024-04-30 京东方科技集团股份有限公司 文字的视频实现方法及系统、电子设备、存储介质
CN112507661B (zh) * 2020-12-15 2023-06-06 北京达佳互联信息技术有限公司 文字特效的实现方法、装置、电子设备及存储介质
CN112614211B (zh) * 2020-12-29 2023-09-22 广州光锥元信息科技有限公司 用于文本、图像自适应排版及动画联动的方法及装置
CN115174824A (zh) * 2021-03-19 2022-10-11 阿里巴巴新加坡控股有限公司 视频生成方法及装置、宣传类型视频生成方法及装置
KR20230023502A (ko) * 2021-08-10 2023-02-17 삼성전자주식회사 애니메이션 효과 제공 방법 및 이를 지원하는 전자 장치

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130021361A1 (en) * 2010-04-21 2013-01-24 Zte Corporation Method and device for rendering user interface font
CN104461483A (zh) * 2013-09-16 2015-03-25 北大方正集团有限公司 一种字体渲染的方法、装置、渲染平台客户端和服务器
CN106294291A (zh) * 2016-07-20 2017-01-04 中国航空无线电电子研究所 一种TrueType字体渲染方法
CN107665186A (zh) * 2017-09-29 2018-02-06 深圳市前海手绘科技文化有限公司 一种特有字体生成方法

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6504545B1 (en) * 1998-03-27 2003-01-07 Canon Kabushiki Kaisha Animated font characters
US7199805B1 (en) * 2002-05-28 2007-04-03 Apple Computer, Inc. Method and apparatus for titling
US20060170684A1 (en) * 2005-01-28 2006-08-03 Microsoft Corporation Font cache and meta-fonts
JPWO2008015825A1 (ja) * 2006-08-01 2009-12-17 株式会社デジモジ 書字フォントデータ及び文字出力システム
JP4874293B2 (ja) * 2008-05-19 2012-02-15 株式会社リコー 記号イメージ生成装置、記号イメージ生成方法、プログラム
KR101583213B1 (ko) * 2013-11-12 2016-01-07 숙명여자대학교산학협력단 키네틱 타이포그래피를 이용한 모바일 인스턴트 메시징 서비스를 위한 이동통신 단말기의 동작 방법 및 그 이동 통신 단말기
DE102014006549B4 (de) * 2014-05-06 2022-05-05 Elektrobit Automotive Gmbh Technik zur Verarbeitung einer Zeichenfolge zur graphischen Darstellung an einer Mensch-Maschine-Schnittstelle
CN106649209A (zh) * 2016-12-30 2017-05-10 深圳天珑无线科技有限公司 文本显示方法和装置
US10242480B2 (en) * 2017-03-03 2019-03-26 Microsoft Technology Licensing, Llc Animated glyph based on multi-axis variable font
CN107909628A (zh) * 2017-10-27 2018-04-13 广西小草信息产业有限责任公司 一种文字处理系统及方法
US11610046B2 (en) * 2019-10-29 2023-03-21 Adobe Inc. Automatic generation of responsive font effects based on font elements

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130021361A1 (en) * 2010-04-21 2013-01-24 Zte Corporation Method and device for rendering user interface font
CN104461483A (zh) * 2013-09-16 2015-03-25 北大方正集团有限公司 一种字体渲染的方法、装置、渲染平台客户端和服务器
CN106294291A (zh) * 2016-07-20 2017-01-04 中国航空无线电电子研究所 一种TrueType字体渲染方法
CN107665186A (zh) * 2017-09-29 2018-02-06 深圳市前海手绘科技文化有限公司 一种特有字体生成方法

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112434488A (zh) * 2020-10-23 2021-03-02 合肥联宝信息技术有限公司 一种自动打标方法、设备以及计算机可读存储介质
CN112434488B (zh) * 2020-10-23 2022-02-01 合肥联宝信息技术有限公司 一种自动打标方法、设备以及计算机可读存储介质
CN113298741A (zh) * 2020-11-13 2021-08-24 阿里巴巴集团控股有限公司 图片合成方法、装置及电子设备
CN113298741B (zh) * 2020-11-13 2024-01-12 阿里巴巴集团控股有限公司 图片合成方法、装置及电子设备
CN113011130A (zh) * 2021-02-20 2021-06-22 安徽文香科技有限公司 一种字符动画编辑方法、装置、电子设备及存储介质
CN113392268A (zh) * 2021-03-31 2021-09-14 百果园技术(新加坡)有限公司 一种特效文本渲染方法、装置、电子设备及存储介质

Also Published As

Publication number Publication date
KR102523843B1 (ko) 2023-04-20
US11507727B2 (en) 2022-11-22
CN111221597A (zh) 2020-06-02
JP2022511764A (ja) 2022-02-01
KR20210060585A (ko) 2021-05-26
JP7210733B2 (ja) 2023-01-23
US20210240913A1 (en) 2021-08-05

Similar Documents

Publication Publication Date Title
WO2020103245A1 (zh) 字体渲染方法、装置及计算机可读存储介质
CN111221596B (zh) 字体渲染方法、装置及计算机可读存储介质
US10789770B1 (en) Displaying rich text on 3D models
JP2010532513A (ja) データシステム及び方法
CN106708506A (zh) 一种从视觉上优化Android应用启动速度的方法及装置
CN108961361B (zh) 生成特效文字图像的方法及系统、计算机设备
Kaluvakuri et al. Harnessing the Potential of CSS: An Exhaustive Reference for Web Styling
CN113031949A (zh) 基于iOS的文本渲染引擎、方法、装置、设备及介质
JP2016522464A (ja) 印刷可能文書ビューア最適化のためのシステムおよび方法
Larsen Mastering SVG: Ace web animations, visualizations, and vector graphics with HTML, CSS, and JavaScript
Bagley et al. Creating reusable well-structured PDF as a sequence of component object graphic (COG) elements
US9965446B1 (en) Formatting a content item having a scalable object
CN115269915A (zh) 歌词显示方法、装置、大屏终端和存储介质
CN112614218B (zh) 一种实现二维文字转换三维文字的展示方法
CN115391692A (zh) 视频处理方法和装置
JP7105209B2 (ja) 画像処理方法、プログラム、及び画像処理システム
JP2019528485A (ja) フォントの生成方法及びその方法を記録した記録媒体並びにフォントの生成装置
Calonaci Practical Responsive Typography
Concolato et al. Design of an efficient scalable vector graphics player for constrained devices
CN113112573B (zh) 基于标记语言的图片生成方法、装置和电子设备
Bellamy-Royds et al. SVG Text Layout: Words as Art
Wang Visual presentation in new media typesetting
Peng Scalable Vector Graphics (SVG)
Mueller CSS3 for Dummies
de Oliveira Bueno Pixels Beyond Colors: Exploring Attributes and Representations of Text-Art Images

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

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 20217011581

Country of ref document: KR

Kind code of ref document: A

ENP Entry into the national phase

Ref document number: 2021529688

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18940753

Country of ref document: EP

Kind code of ref document: A1