Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Method and device for text drawing

A text and drawing unit technology, applied in the field of drawing text, can solve the problems of poor effect, Canvas only display a part of a character, etc., and achieve the effect of good drawing effect

Inactive Publication Date: 2017-08-08
BEIJING GRIDSUM TECH CO LTD
View PDF3 Cites 4 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

However, when the text is too long and the complete text cannot be drawn on the Canvas when it is reduced to the visible range, the part of the text that exceeds the width of the Canvas will not be drawn on the Canvas, but will be drawn beyond the Canvas Partially omitted, and it may also appear that only a part of a character may be displayed on the far right of the Canvas
In summary, it can be seen that the existing methods for drawing text on Canvas are poor

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method and device for text drawing
  • Method and device for text drawing
  • Method and device for text drawing

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0021] Hereinafter, exemplary embodiments of the present disclosure will be described in more detail with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0022] In order to solve the problem of poor effect of the existing method of drawing text on Canvas, an embodiment of the present invention provides a method of drawing text, such as figure 1 As shown, the method includes:

[0023] 101. Before drawing each character on the Canvas, calculate the current remaining width.

[0024] In the actual Canvas application scenario, for the convenience of use, a general Can...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a method and device for text drawing, relates to the field of computer technologies and aims to solve the problem in poor effects of current text drawing methods on Canvas. The method disclosed by the invention comprises the steps that the current rest width is computed before drawing of each character on the Canvas, wherein the rest width is equal to the difference which is obtained by subtraction of a character end point horizontal coordinate of a previous character from the Canvas width, and the character end point horizontal coordinate is the sum of a character start point horizontal coordinate of the previous character and the character width of the previous character; whether the rest width is smaller than the character width of a to-be-drawn character is judged; if the rest width is not smaller than the character width of the to-be-drawn character, the to-be-drawn character will be drawn after the previous character; and if the rest width is smaller than the character width of the to-be-drawn character, the to-be-drawn character will be drawn on another row. The method and device disclosed by the invention are applicable to text drawing with application of Canvas elements.

Description

Technical field [0001] The present invention relates to the field of computer technology, in particular to a method and device for drawing text. Background technique [0002] The Canvas element is a new element in Hyper Text Markup Language 5.0 (HTML5 for short) applications. It is used to draw graphics on web pages. The Canvas element itself does not have the ability to draw. It presents a drawing API to the client, so that the client uses JavaScript to draw the graphics content that it wants to draw on the Canvas. In addition, you can also draw characters, text, or add images to Canvas through a variety of methods. [0003] When drawing text on a Canvas with a limited width, it is usually to set the starting point coordinates of the drawing first, and then draw the text on the Canvas from left to right from the starting point coordinates at one time. Because Canvas itself only supports single line drawing, so when needed When the drawn text is relatively long and the total leng...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06F9/44
Inventor 周建涛
Owner BEIJING GRIDSUM TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products