Display devices and font generation methods
By using the Bézier curve generation method in drawing and writing software, text patterns with different transparency and width are generated according to the user's writing trajectory and speed, solving the problem that existing technologies cannot generate personalized text and achieving beautiful and personalized text effects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-30
- Publication Date
- 2026-03-10
AI Technical Summary
Existing drawing and writing software cannot generate personalized text, making it difficult to meet users' demands for aesthetics and personalization.
By capturing the user's writing trajectory, Bézier curves are used to generate text patterns with different transparency and width, simulating the effect of calligraphy.
It enables the generation of beautiful and personalized text effects based on the user's writing trajectory, thus meeting the user's aesthetic needs.
Smart Images

Figure CN115564859B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of computer, and particularly relate to a display device and a font generation method. BACKGROUND
[0002] Windows Presentation Foundation (WPF) provides a unified description and operation method for user interface, 2D / 3D graphics, documents and media. A user can write characters using a mouse on a hardware device without a touch screen or using a touch pen, a finger, etc. on a hardware device with a touch screen by using a drawing and writing software developed by WPF technology.
[0003] However, in the existing drawing and writing software, the characters written by a user are only character graphics formed according to the handwriting of the user, and only the operation track of the user can be displayed. With the increasing desire of people for beauty and individualization, compared with the existing drawing and writing software that can only form character graphics according to the handwriting of the user, more and more users hope to use individualized fonts, such as brush calligraphy, when communicating. That is, the existing drawing and writing software can no longer meet the needs of users for beauty and individualization. SUMMARY
[0004] Embodiments of the present application provide a display device and a font generation method, which can generate individualized characters according to user operations, so that information dissemination is more vivid and beautiful.
[0005] In a first aspect, embodiments of the present application provide a display device, comprising:
[0006] a display configured to display an image picture and a user interface;
[0007] a controller connected to the display, the controller being configured to:
[0008] obtain a writing track of a user, and determine a Bezier curve corresponding to the writing track according to each node in the writing track;
[0009] determine the transparency and the width of a Bezier curve segment corresponding to adjacent nodes in the writing track according to the writing speed between the adjacent nodes in the writing track, respectively;
[0010] determine a character pattern corresponding to the writing track according to the transparency and the width of the Bezier curve segment corresponding to the adjacent nodes in the writing track;
[0011] send the character pattern corresponding to the writing track to the display for display.
[0012] In an implementation, the controller is specifically configured to:
[0013] obtain a pre-set correspondence between writing speed and transparency;
[0014] determine, according to the pre-set correspondence between writing speed and transparency, the transparency corresponding to the writing speed between the adjacent nodes in the writing trajectory as the transparency of the corresponding Bezier curve segment between the adjacent nodes in the writing trajectory.
[0015] In an implementation, the controller is specifically configured to:
[0016] obtain the writing pressing force between the adjacent nodes in the writing trajectory;
[0017] obtain a pre-set correspondence between writing speed, writing pressing force and transparency;
[0018] determine, according to the pre-set correspondence between writing speed, writing pressing force and transparency, and the writing speed and writing pressing force between the adjacent nodes in the writing trajectory, the transparency of the corresponding Bezier curve segment between the adjacent nodes in the writing trajectory.
[0019] In an implementation, the controller is specifically configured to:
[0020] obtain a pre-set correspondence between writing speed and width;
[0021] if the current two adjacent nodes in the writing trajectory belong to the first two nodes in the writing trajectory, determine, according to the pre-set correspondence between writing speed and width and the writing speed between the current two adjacent nodes in the writing trajectory, the width of the corresponding Bezier curve segment between the current two adjacent nodes in the writing trajectory;
[0022] if the current two adjacent nodes in the writing trajectory do not belong to the first two nodes in the writing trajectory, determine, according to the pre-set correspondence between writing speed and width, the writing speed between the current two adjacent nodes in the writing trajectory, the length of the target Bezier curve segment corresponding to the current two adjacent nodes and the width of the previous Bezier curve segment adjacent to the target Bezier curve segment, the width of the target Bezier curve segment.
[0023] In an implementation, the controller is specifically configured to:
[0024] If the current two adjacent nodes in the writing trajectory do not belong to the first two nodes in the writing trajectory, the following method is used to determine the width Wc of the target Bezier curve segment corresponding to the current two adjacent nodes in the writing trajectory:
[0025] Wc = Wp + min(abs(k*s-Wp), d*w)
[0026] wherein Wp represents the width of the previous Bezier curve segment adjacent to the target Bezier curve segment, k represents a preset proportion coefficient between writing speed and width, s represents the writing speed between the current two adjacent nodes in the writing trajectory, d represents the length of the target Bezier curve segment, and w represents a preset coefficient.
[0027] In a possible implementation, the controller is further configured to:
[0028] obtain the writing pressing force between adjacent nodes in the writing trajectory;
[0029] obtain a preset corresponding relationship between writing pressing force and width adjustment range;
[0030] adjust the width of the Bezier curve segment corresponding to the adjacent nodes in the writing trajectory according to the width adjustment range corresponding to the writing pressing force between the adjacent nodes in the writing trajectory.
[0031] In a possible implementation, the controller is further configured to:
[0032] after determining the character pattern corresponding to the writing trajectory, add a plurality of line segments of a preset length to the contour of the character pattern according to the slope between the current node and the previous node in the writing trajectory.
[0033] In a second aspect, the embodiments of the present application provide a font generation method, comprising:
[0034] obtaining a writing trajectory of a user, and determining a Bezier curve corresponding to the writing trajectory according to each node in the writing trajectory;
[0035] determining the transparency and the width of the Bezier curve segment corresponding to adjacent nodes in the writing trajectory according to the writing speed between the adjacent nodes in the writing trajectory, respectively;
[0036] determining a character pattern corresponding to the writing trajectory according to the transparency and the width of the Bezier curve segment corresponding to the adjacent nodes in the writing trajectory.
[0037] In one feasible implementation, determining the transparency of the corresponding Bézier curve segments between adjacent nodes in the writing trajectory based on the writing speed between adjacent nodes in the writing trajectory includes:
[0038] Obtain the pre-set correspondence between writing speed and transparency;
[0039] Based on the pre-defined correspondence between writing speed and transparency, the transparency corresponding to the writing speed between adjacent nodes in the writing trajectory is determined as the transparency of the corresponding Bézier curve segment between adjacent nodes in the writing trajectory.
[0040] In one feasible implementation, determining the transparency of the corresponding Bézier curve segments between adjacent nodes in the writing trajectory based on the writing speed between adjacent nodes in the writing trajectory includes:
[0041] Obtain the writing pressure intensity between adjacent nodes in the writing trajectory;
[0042] Obtain the pre-set writing speed and the correspondence between writing pressure and transparency;
[0043] Based on the pre-set correspondence between writing speed, writing pressure, and transparency, and the writing speed and writing pressure between adjacent nodes in the writing trajectory, the transparency of the corresponding Bézier curve segments between adjacent nodes in the writing trajectory is determined.
[0044] In one feasible implementation, determining the width of the corresponding Bézier curve segment between adjacent nodes in the writing trajectory based on the writing speed between adjacent nodes in the writing trajectory includes:
[0045] Obtain the pre-set correspondence between writing speed and width;
[0046] If the current two adjacent nodes in the writing trajectory belong to the first two nodes in the writing trajectory, the width of the corresponding Bézier curve segment between the current two adjacent nodes in the writing trajectory is determined according to the pre-set correspondence between writing speed and width and the writing speed between the current two adjacent nodes in the writing trajectory.
[0047] If the current two adjacent nodes in the writing trajectory do not belong to the previous two nodes in the writing trajectory, the width of the target Bézier curve segment is determined according to the pre-set correspondence between writing speed and width, the writing speed between the current two adjacent nodes in the writing trajectory, the length of the target Bézier curve segment corresponding to the current two adjacent nodes, and the width of the previous Bézier curve segment adjacent to the target Bézier curve segment.
[0048] In one feasible implementation, if the current two adjacent nodes in the writing trajectory do not belong to the previous two nodes in the writing trajectory, the width Wc of the target Bézier curve segment corresponding to the current two adjacent nodes in the writing trajectory is determined in the following way:
[0049] Wc=Wp+min(abs(k*s-Wp),d*w)
[0050] Wherein, Wp represents the width of the preceding Bézier curve segment adjacent to the target Bézier curve segment, k represents the pre-set ratio coefficient between writing speed and width, s represents the writing speed between the current two adjacent nodes in the writing trajectory, d represents the length of the target Bézier curve segment, and w represents the pre-set coefficient.
[0051] In one feasible implementation, it further includes:
[0052] Obtain the writing pressure intensity between adjacent nodes in the writing trajectory;
[0053] Obtain the pre-set correspondence between writing pressure and width adjustment range;
[0054] The width of the Bezier curve segment corresponding to the adjacent nodes in the writing trajectory is adjusted according to the width adjustment range corresponding to the writing pressure between adjacent nodes in the writing trajectory.
[0055] In one feasible implementation, it further includes:
[0056] After determining the text pattern corresponding to the writing trajectory, multiple lines of preset length are added to the outline of the text pattern according to the slope between the current node and the previous node in the writing trajectory.
[0057] The display device and font generation method provided in this application determine the Bézier curve corresponding to each node in the writing trajectory. Then, based on the writing speed between adjacent nodes in the writing trajectory, the transparency and width of the corresponding Bézier curve segments between adjacent nodes are determined. Finally, based on the transparency and width of the corresponding Bézier curve segments between adjacent nodes in the writing trajectory, the text pattern corresponding to the writing trajectory is determined. In this application embodiment, the display device can generate Bézier curve segments with different transparency and width according to the user's writing trajectory and writing speed. After these Bézier curve segments form a text pattern, they can create characters similar to calligraphy, thereby better meeting the user's pursuit of aesthetics and personalization. Attached Figure Description
[0058] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments of this application or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0059] Figure 1 This is a schematic diagram of a display device applicable to the embodiments of this application;
[0060] Figure 2 A hardware configuration block diagram of a display device 200 according to some embodiments is shown;
[0061] Figure 3 This is a schematic diagram of a Bézier curve provided in an embodiment of this application;
[0062] Figure 4 This is a flowchart illustrating a font generation method provided in an embodiment of this application. Detailed Implementation
[0063] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. Furthermore, although the disclosure in this application is described with reference to one or several exemplary examples, it should be understood that each aspect of these disclosures can also constitute a complete implementation method on its own.
[0064] It should be noted that the brief descriptions of terms in this application are only for the convenience of understanding the embodiments described below, and are not intended to limit the embodiments of this application. Unless otherwise stated, these terms should be understood in their ordinary and common meaning.
[0065] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar or related objects or entities, and do not necessarily imply a specific order or sequence, unless otherwise specified. It should be understood that such terms can be used interchangeably where appropriate, for example, to implement the embodiments in a sequence other than those given in the illustrations or descriptions of this application.
[0066] Furthermore, the terms “comprising” and “having”, and any variations thereof, are intended to cover but not exclusively include, for example, a product or device that includes a series of components is not necessarily limited to those that are explicitly listed, but may include other components that are not explicitly listed or that are inherent to such product or device.
[0067] As used in this application, the term "module" means any known or subsequently developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and / or software code capable of performing the functions associated with that element.
[0068] Figure 1 This is a schematic diagram illustrating a usage scenario of the display device according to an embodiment. For example... Figure 1 As shown, the display device 200 also communicates with the server 400, and the user can operate the display device 200 through the smart device 300 or the control device 100.
[0069] In some embodiments, the control device 100 may be a remote control. Communication between the remote control and the display device includes at least one of infrared protocol communication, Bluetooth protocol communication, and other short-range communication methods, controlling the display device 200 wirelessly or via a wired connection. Users can control the display device 200 by inputting user commands through at least one method, such as buttons on the remote control, voice input, or control panel input.
[0070] In some embodiments, the smart device 300 may include any one of a mobile terminal, tablet computer, computer, laptop computer, AR / VR device, etc.
[0071] In some embodiments, a smart device 300 may also be used to control the display device 200. For example, an application running on the smart device may be used to control the display device 200.
[0072] In some embodiments, the smart device 300 and the display device may also be used for data communication.
[0073] In some embodiments, the display device 200 also communicates with the server 400. The display device 200 may communicate via a local area network (LAN), wireless local area network (WLAN), and other networks. The server 400 may provide various content and interactive features to the display device 200. The server 400 may be a cluster or multiple clusters, and may include one or more types of servers.
[0074] In some embodiments, software steps executed by one execution entity can be migrated to another execution entity with which it communicates data, as needed. For example, software steps executed by a server can be migrated to a display device with which it communicates data, and vice versa.
[0075] Reference Figure 2 , Figure 2 A hardware configuration block diagram of a display device 200 according to an exemplary embodiment is shown.
[0076] In some embodiments, the display device 200 includes at least one of a communicator 220, an external device interface 240, a controller 250, a display 260, a sensor module 270, a memory, and a user interface 280.
[0077] In some embodiments, the controller includes a central processing unit, a graphics processing unit, random access memory (RAM), read-only memory (ROM), and a first interface to an nth interface for input / output.
[0078] In some embodiments, the display 260 includes a display screen component for presenting an image, a driving component for driving image display, a component for receiving image signals output from a controller, and a user control UI interface, etc.
[0079] In some embodiments, the display 260 may be at least one of a liquid crystal display, an OLED display, and a projection display, and may also be a projection device and a projection screen.
[0080] In some embodiments, the communicator 220 is a component used to communicate with external devices or servers according to various communication protocol types. For example, the communicator may include at least one of the following: a Wi-Fi module, a Bluetooth module, a wired Ethernet module, other network communication protocol chips or near-field communication protocol chips, and an infrared receiver. The display device 200 can establish the transmission and reception of control signals and data signals with the control device 100 or the server 400 through the communicator 220.
[0081] In some embodiments, the external device interface 240 may include, but is not limited to, one or more interfaces such as: High Definition Multimedia Interface (HDMI), analog or data high-definition component input interface (component), composite video input interface (CVBS), USB input interface (USB), RGB port, etc. It may also be a composite input / output interface formed by multiple interfaces mentioned above.
[0082] In some embodiments, the controller 250 controls the operation of the display device and responds to user operations via various software control programs stored in memory. The controller 250 controls the overall operation of the display device 200. For example, in response to receiving a user command to select a UI object to display on the display 260, the controller 250 can perform operations related to the object selected by the user command.
[0083] In some embodiments, the object can be any of the optional objects, such as a hyperlink, an icon, or other operable controls. Operations related to the selected object include: displaying links to hyperlinked pages, documents, images, etc., or performing operations corresponding to the program associated with the icon.
[0084] In some embodiments, the user interface 280 is an interface that can be used to receive control input (e.g., physical buttons on the display device body, mouse, or others).
[0085] In some embodiments, the sensor module 270 may include a pressure sensor, a touch sensor, etc. The pressure sensor is used to sense pressure signals and can convert these signals into electrical signals. The touch sensor, also known as a touch panel or touch-sensitive surface, can be disposed on a display screen. A touch screen, also called a touch display, is formed by the touch sensor and the display screen. The touch sensor is used to detect touch operations applied to or near it.
[0086] In existing drawing and writing software developed using WPF technology, the text written by the user is merely a graphic representation of the user's handwriting, which can only display the user's operation trajectory and is no longer sufficient to meet the user's pursuit of aesthetics and personalization.
[0087] To address the aforementioned technical problems, this application provides a display device that can generate Bézier curve segments with different transparency and width based on the user's writing trajectory and speed. These Bézier curve segments, when combined to form text patterns, can create characters resembling calligraphy, thereby better meeting the user's pursuit of aesthetics and personalization. Detailed embodiments are described below.
[0088] In one feasible implementation, the controller of the above-described display device can be configured to perform the following steps:
[0089] Step a: Obtain the user's writing trajectory and determine the corresponding Bézier curve based on each node in the writing trajectory.
[0090] Bézier curves, also known as Bézier curves or Bézier curves, are mathematical curves used in two-dimensional graphics applications. General vector graphics software uses them to accurately draw curves. A Bézier curve consists of line segments and nodes; nodes are draggable pivot points, and line segments are like stretchable rubber bands. It creates and edits graphics by controlling four points on the curve (the start point, the end point, and two separate midpoints). The control line located in the center of the curve plays a crucial role. This line is virtual, intersecting the Bézier curve in the middle, and its two ends are control endpoints. Moving the endpoints changes the curvature (degree of bending) of the Bézier curve; moving the midpoints (i.e., moving the virtual control line) causes the Bézier curve to move uniformly while the start and end points are locked.
[0091] Among them, a (n-1) order Bézier curve can be formed by n data points.
[0092] For example, given points P0 and P1, a linear Bézier curve is simply a straight line between the two points. This line is given by the following equation:
[0093] B(t)=P0+(P1-P0)t=(1-t)P0+tP1,t∈[0,1]
[0094] The path of the second-order Bézier curve is traced by the function B(t) given points P0, P1, and P2:
[0095] B(t)=(1-t) 2 P0+2t(1-t)P1+t 2 P2,t∈[0,1]
[0096] The parametric equation is:
[0097] x = (1 - t) 2 *0+2t(1-t)*1+t 2 *1=2t(1-t)+t 2
[0098] y = (1-t) 2 *1+2t(1-t)*1+t 2 *0=(1-t) 2 +2t(1-t)
[0099] The path of the third-order Bézier curve is traced by the function B(t) given points P0, P1, P2, and P3:
[0100] B(t)=P0(1-t)3 +3P1t(1-t) 2 +3P2t 2 (1-t)+P3t 3 ,t∈[0,1]
[0101] The curve starts at P0, moves towards P1, and then from P2 to P3. It generally does not pass through P1 or P2; these two points only provide directional information. The distance between P0 and P1 determines the "length" of the curve in the direction of P2 before turning towards P3.
[0102] To better understand the embodiments of this application, please refer to... Figure 3 , Figure 3 This is a schematic diagram of a Bézier curve provided in an embodiment of this application.
[0103] In this embodiment of the application, the x and y values can be calculated according to the Bezier formula based on the user's writing trajectory when the user's writing operation is detected, according to the set number of n. Then, the Bezier curve corresponding to the writing trajectory can be obtained based on the obtained x and y values.
[0104] Optionally, users can perform writing operations using a mouse, stylus, finger, or other methods.
[0105] Step b: Based on the writing speed between adjacent nodes in the above writing trajectory, determine the transparency and width of the corresponding Bézier curve segments between adjacent nodes in the above writing trajectory.
[0106] In this embodiment of the application, it is understood that, for writing calligraphy, the lines are darker in areas where the stroke is slow, and lighter in areas where the stroke is fast. Additionally, the lines are generally thicker in areas where the stroke is slow, and narrower in areas where the stroke is fast.
[0107] Therefore, in this embodiment of the application, the transparency and width of the corresponding Bézier curve segments between adjacent nodes in the above writing trajectory can be determined according to the writing speed between adjacent nodes in the above writing trajectory.
[0108] Step c: Determine the text pattern corresponding to the above writing trajectory based on the transparency and width of the corresponding Bézier curve segments between adjacent nodes in the above writing trajectory.
[0109] In this embodiment of the application, after determining the transparency and width of the corresponding Bézier curve segments between adjacent nodes in the above writing trajectory, the text pattern corresponding to the above writing trajectory can be determined based on the transparency and width of the corresponding Bézier curve segments between adjacent nodes in the above writing trajectory.
[0110] In other words, the transparency and width of the text pattern determined by the controller will change as the user writes.
[0111] Step d: Send the text pattern corresponding to the above writing trajectory to the monitor for display.
[0112] In this embodiment of the application, after the controller determines the text pattern corresponding to the user's writing trajectory, it can send the text pattern to the display for display, so that the user can observe the text he / she is writing in real time.
[0113] The display device provided in this application embodiment can generate Bézier curve segments with different transparency and width according to the user's writing trajectory and writing speed. After these Bézier curve segments form text patterns, they can form characters similar to calligraphy, thereby better meeting the user's pursuit of aesthetics and personalization.
[0114] Based on the content described in the above embodiments, in a feasible implementation of this application, according to the writing speed between adjacent nodes in the writing trajectory, the transparency of the corresponding Bézier curve segments between adjacent nodes in the writing trajectory can be determined in the following way:
[0115] Obtain the pre-defined correspondence between writing speed and transparency. Based on this correspondence, determine the transparency corresponding to the writing speed between adjacent nodes in the writing trajectory as the transparency of the corresponding Bézier curve segment between adjacent nodes in the writing trajectory.
[0116] In this embodiment, various different transparency levels can be preset. For example, assuming the canvas and the drawn text / pattern use RGB primary colors, r, g, and b are the final color values of the text / pattern; r1, g1, and b1 are the upper layer color values; and r2, g2, and b2 are the lower layer color values, if Alpha = transparency, then when Alpha = 50%:
[0117]
[0118]
[0119]
[0120] When Alpha < 50%
[0121] r = r1 - r1 / Alpha + r2 / Alpha
[0122] g = g1 - g1 / Alpha + g2 / Alpha
[0123] b = b1 - b1 / Alpha + b2 / Alpha
[0124] When Alpha > 50%
[0125] r = r1 / Alpha + r2 - r2 / Alpha
[0126] g = g1 / Alpha + g2 - g2 / Alpha
[0127] b = b1 / Alpha + b2 - b2 / Alpha
[0128] In addition, the correspondence between writing speed V and transparency Alpha is preset. For example, when V < k1, the corresponding transparency Alpha is 90%; when k1 ≤ V < k2, the corresponding transparency Alpha is 80%; when k2 ≤ V < k3, the corresponding transparency Alpha is 70%; when k3 ≤ V < k4, the corresponding transparency Alpha is 50%; and when k4 ≤ V, the corresponding transparency Alpha is 40%.
[0129] After establishing the correspondence between writing speed and transparency, the transparency of the corresponding Bézier curve segments between adjacent nodes in the writing trajectory can be determined based on this correspondence and the writing speed between adjacent nodes in the writing trajectory.
[0130] Based on the content described in the above embodiments, in a feasible implementation of this application, according to the writing speed between adjacent nodes in the writing trajectory, the transparency of the corresponding Bézier curve segments between adjacent nodes in the writing trajectory can also be determined in the following way:
[0131] The writing pressure intensity between adjacent nodes in the writing trajectory is obtained, as well as the pre-set writing speed and the correspondence between writing pressure intensity and transparency. Based on this correspondence, and the writing speed and writing pressure intensity between adjacent nodes in the writing trajectory, the transparency of the corresponding Bézier curve segments between adjacent nodes in the writing trajectory is determined.
[0132] Understandably, when writing calligraphy, areas with slower stroke speed and greater pressure will have darker lines, while areas with faster stroke speed and less pressure will generally have lighter lines. Therefore, in this embodiment, the transparency of the corresponding Bézier curve segments between adjacent nodes in the writing trajectory can be determined simultaneously based on both writing speed and pressure.
[0133] For example, the correspondence between writing speed V, writing pressure G, and transparency Alpha can be preset. For example, refer to Table 1, which is a table showing the correspondence between writing speed, writing pressure, and transparency.
[0134] Table 1 shows the correspondence between writing speed, writing pressure, and transparency.
[0135] Alpha G < f1 f1 < G < f2 F2 < G V < k1 85% 90% 95% k1 < V < k2 75% 80% 85% k2 < V < k3 65% 70% 75% k3 < V < k4 45% 50% 55% k4 < V 35% 40% 45%
[0136] In this embodiment, based on the above correspondence table and the writing speed and writing pressure between adjacent nodes in the writing trajectory, the transparency of the corresponding Bézier curve segments between adjacent nodes in the writing trajectory can be determined.
[0137] Based on the content described in the above embodiments, in a feasible implementation of this application, according to the writing speed between adjacent nodes in the writing trajectory, the width of the corresponding Bézier curve segment between adjacent nodes in the writing trajectory can be determined in the following way:
[0138] Obtain the pre-set correspondence between writing speed and width; if the current two adjacent nodes in the writing trajectory belong to the previous two nodes in the writing trajectory, determine the width of the corresponding Bézier curve segment between the current two adjacent nodes in the writing trajectory based on the pre-set correspondence between writing speed and width and the writing speed between the current two adjacent nodes in the writing trajectory.
[0139] In the embodiments of this application, a pre-defined correspondence between writing speed V and width L is established. For example, when V < k1, the corresponding width L is L1; when k1 ≤ V < k2, the corresponding width L is L2; when k2 ≤ V < k3, the corresponding width L is L3; when k3 ≤ V < k4, the corresponding width L is L4; and when k4 ≤ V, the corresponding width L is L5.
[0140] After establishing the correspondence between writing speed and width, the width of the Bézier curve segment between the first two adjacent nodes in the writing trajectory can be determined based on this correspondence and the writing speed between adjacent nodes in the writing trajectory.
[0141] It is understandable that, assuming a user obtains three adjacent nodes during the writing process, namely a, b, and c, the writing speed may be high in the ab segment and very low in the bc segment. This results in a noticeable step-like change at the intersection of the ab and bc segments, making the text lines less smooth and natural.
[0142] To prevent the above problems from occurring, in this embodiment of the application, if the current two adjacent nodes in the writing trajectory do not belong to the previous two nodes in the writing trajectory, the width of the target Bézier curve segment is determined according to the pre-set correspondence between writing speed and width, the writing speed between the current two adjacent nodes in the writing trajectory, the length of the target Bézier curve segment corresponding to the current two adjacent nodes, and the width of the previous Bézier curve segment adjacent to the target Bézier curve segment.
[0143] In one feasible implementation, the width Wc of the target Bézier curve segment between the current two adjacent nodes in the writing trajectory can be determined in the following way:
[0144] Wc=Wp+min(abs(k*s-Wp),d*w)
[0145] Where Wp represents the width of the preceding Bézier curve segment adjacent to the target Bézier curve segment, k represents the pre-set ratio coefficient between writing speed and width, s represents the writing speed between the current two adjacent nodes in the writing trajectory, d represents the length of the target Bézier curve segment, and w represents the pre-set coefficient representing the maximum amount of variation in line width per unit distance. Specifically, d*w is the maximum amount by which the width of the current line segment can widen or narrow relative to the width of the preceding line segment within the length of the current line segment.
[0146] In this embodiment of the application, the above modifications can effectively reduce the width difference between adjacent segments of the Bézier curve, making the text lines smoother and more natural.
[0147] Based on the content described in the above embodiments, in a feasible implementation of this application, after determining the width of the corresponding Bézier curve segments between adjacent nodes in the writing trajectory according to the above method, the writing pressure between adjacent nodes in the writing trajectory and the pre-set correspondence between the writing pressure and the width adjustment range can also be obtained, and the width of the corresponding Bézier curve segments between adjacent nodes in the writing trajectory can be adjusted according to the width adjustment range corresponding to the writing pressure between adjacent nodes in the writing trajectory.
[0148] For example, when the writing pressure between two nodes in the writing trajectory is large, the width of the Bézier curve segment between these two nodes can be increased appropriately; when the writing pressure between two nodes in the writing trajectory is small, the width of the Bézier curve segment between these two nodes can be decreased appropriately.
[0149] Based on the description in the above embodiments, in one feasible implementation of this application, after determining the transparency and width of the corresponding Bézier curve segments between adjacent nodes in the writing trajectory, the Bézier curves corresponding to the writing trajectory can be filled using the filling effect of the graphics module according to the transparency and width of each Bézier curve segment to obtain the text pattern corresponding to the writing trajectory.
[0150] In addition, after determining the text pattern corresponding to the writing trajectory, multiple lines of preset length can be added to the outline of the text pattern based on the slope between the current node and the previous node in the writing trajectory.
[0151] Optionally, multiple lines of different lengths can be added to the outline of the text pattern, and the color of each line will gradually change from dark to light, thereby creating "burrs" on the edge of the text pattern outline, making the text pattern closer to the calligraphy font.
[0152] In this embodiment, the display device can generate Bezier curve segments with different transparency and width according to the user's writing trajectory and writing speed. After these Bezier curve segments form text patterns, they can form characters similar to calligraphy. Even users who cannot write calligraphy can write beautiful calligraphy characters and signatures. This is suitable for teaching, calligraphy practice, entertainment and other scenarios, and can better meet users' needs for beauty and personalization.
[0153] Based on the content described in the above embodiments, this application also provides a font generation method, referring to... Figure 4 , Figure 4 This is a flowchart illustrating a font generation method provided in an embodiment of this application. In one feasible implementation, the method includes:
[0154] S401. Obtain the user's writing trajectory and determine the Bézier curve corresponding to the writing trajectory based on each node in the writing trajectory.
[0155] S402. Based on the writing speed between adjacent nodes in the writing trajectory, determine the transparency and width of the corresponding Bézier curve segments between adjacent nodes in the writing trajectory.
[0156] S403. Determine the text pattern corresponding to the writing trajectory based on the transparency and width of the corresponding Bézier curve segments between adjacent nodes in the writing trajectory.
[0157] The font generation method provided in this application can generate Bézier curve segments with different transparency and width according to the user's writing trajectory and writing speed. After these Bézier curve segments form a text pattern, they can form characters similar to calligraphy, thereby better meeting the user's pursuit of aesthetics and personalization.
[0158] In one feasible implementation, step S402 above, which determines the transparency of the corresponding Bézier curve segments between adjacent nodes in the writing trajectory based on the writing speed between adjacent nodes, includes:
[0159] Obtain the pre-defined correspondence between writing speed and transparency, and based on this correspondence, determine the transparency corresponding to the writing speed between adjacent nodes in the writing trajectory as the transparency of the corresponding Bézier curve segment between adjacent nodes in the writing trajectory.
[0160] In one feasible implementation, step S402 above, which determines the transparency of the corresponding Bézier curve segments between adjacent nodes in the writing trajectory based on the writing speed between adjacent nodes, includes:
[0161] Obtain the writing pressure intensity between adjacent nodes in the writing trajectory, as well as the pre-set writing speed and the correspondence between writing pressure intensity and transparency; based on the pre-set writing speed and the correspondence between writing pressure intensity and transparency, and the writing speed and writing pressure intensity between adjacent nodes in the writing trajectory, determine the transparency of the corresponding Bézier curve segments between adjacent nodes in the writing trajectory.
[0162] In one feasible implementation, step S402 above, which determines the width of the corresponding Bézier curve segment between adjacent nodes in the writing trajectory based on the writing speed between adjacent nodes, includes:
[0163] Obtain the pre-set correspondence between writing speed and width.
[0164] If the current two adjacent nodes in the writing trajectory belong to the first two nodes in the writing trajectory, the width of the corresponding Bézier curve segment between the current two adjacent nodes in the writing trajectory is determined according to the pre-set correspondence between writing speed and width and the writing speed between the current two adjacent nodes in the writing trajectory.
[0165] If the two adjacent nodes in the writing trajectory are not the first two nodes in the writing trajectory, the width of the target Bézier curve segment is determined based on the pre-set correspondence between writing speed and width, the writing speed between the two adjacent nodes in the writing trajectory, the length of the target Bézier curve segment between the two adjacent nodes, and the width of the previous Bézier curve segment adjacent to the target Bézier curve segment.
[0166] In one feasible implementation, if the current two adjacent nodes in the writing trajectory do not belong to the previous two nodes in the writing trajectory, the width Wc of the target Bézier curve segment corresponding to the current two adjacent nodes in the writing trajectory is determined in the following way:
[0167] Wc=Wp+min(abs(k*s-Wp),d*w)
[0168] Where Wp represents the width of the preceding Bézier curve segment adjacent to the target Bézier curve segment, k represents the pre-set ratio coefficient between the writing speed and the width, s represents the writing speed between the current two adjacent nodes in the writing trajectory, d represents the length of the target Bézier curve segment, and w represents the pre-set coefficient.
[0169] In one feasible implementation, the above method further includes:
[0170] Obtain the writing pressure between adjacent nodes in the writing trajectory, as well as the correspondence between the pre-set writing pressure and the width adjustment range; adjust the width of the Bézier curve segment corresponding to the adjacent nodes in the writing trajectory according to the width adjustment range corresponding to the writing pressure between adjacent nodes in the writing trajectory.
[0171] In one feasible implementation, the above method further includes:
[0172] After determining the text pattern corresponding to the writing trajectory, multiple lines of preset length are added to the outline of the text pattern according to the slope between the current node and the previous node in the writing trajectory.
[0173] The font generation method provided in this application embodiment can generate Bézier curve segments with different transparency and width according to the user's writing trajectory and writing speed. After these Bézier curve segments form a text pattern, they can form characters similar to calligraphy. Even users who cannot write calligraphy can write beautiful calligraphy characters and signatures. It is suitable for teaching, calligraphy practice, entertainment and other scenarios, and can better meet users' needs for beauty and personalization.
[0174] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or modules, and may be electrical, mechanical, or other forms.
[0175] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0176] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing unit, or each module can exist physically separately, or two or more modules can be integrated into one unit. The unit composed of the above modules can be implemented in hardware or in the form of hardware plus software functional units.
[0177] The integrated modules implemented as software functional modules described above can be stored in a computer-readable storage medium. These software functional modules, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of this application.
[0178] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0179] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A display device, characterized by comprising: The application relates to a handwriting input device, comprising: a display configured to display an image frame and a user interface; a controller connected to the display, the controller being configured to: acquire a user's handwriting track, and determine a Bezier curve corresponding to the handwriting track according to each node in the handwriting track; acquire a preset corresponding relationship between writing speed and width; and determine the transparency and width of a Bezier curve segment corresponding to adjacent nodes in the handwriting track according to the writing speed between the adjacent nodes in the handwriting track; wherein, if the current two adjacent nodes in the handwriting track do not belong to the first two nodes in the handwriting track, the width Wc of a target Bezier curve segment corresponding to the current two adjacent nodes in the handwriting track is determined in the following manner: Wc = Wp + min(abs(k*s-Wp), d*w) wherein, Wp represents the width of a previous Bezier curve segment adjacent to the target Bezier curve segment, k represents a preset proportion coefficient between writing speed and width, s represents the writing speed between the current two adjacent nodes in the handwriting track, d represents the length of the target Bezier curve segment, and w represents a preset coefficient; determine a character pattern corresponding to the handwriting track according to the transparency and width of the Bezier curve segment corresponding to the adjacent nodes in the handwriting track; and send the character pattern corresponding to the handwriting track to the display for display.
2. The display device of claim 1, wherein, The controller is specifically configured to: acquire a preset corresponding relationship between writing speed and transparency; determine the transparency corresponding to the writing speed between the adjacent nodes in the handwriting track as the transparency of the Bezier curve segment corresponding to the adjacent nodes in the handwriting track according to the preset corresponding relationship between writing speed and transparency.
3. The display device of claim 1, wherein, The controller is specifically configured to: acquire the writing pressing force between the adjacent nodes in the handwriting track; acquire a preset corresponding relationship between writing speed, writing pressing force and transparency; determine the transparency of the Bezier curve segment corresponding to the adjacent nodes in the handwriting track according to the preset corresponding relationship between writing speed, writing pressing force and transparency, and the writing speed and writing pressing force between the adjacent nodes in the handwriting track.
4. The display device of claim 1, wherein, The controller is specifically configured to: if the current two adjacent nodes in the handwriting track belong to the first two nodes in the handwriting track, determine the width of the Bezier curve segment corresponding to the current two adjacent nodes in the handwriting track according to the preset corresponding relationship between writing speed and width and the writing speed between the current two adjacent nodes in the handwriting track.
5. The display device of claim 1, wherein, The controller is further configured to: acquire the writing pressing force between the adjacent nodes in the handwriting track; acquire a preset corresponding relationship between writing pressing force and width adjustment range; adjust the width of the Bezier curve segment corresponding to the adjacent nodes in the handwriting track according to the width adjustment range corresponding to the writing pressing force between the adjacent nodes in the handwriting track.
6. The display device according to any one of claims 1 to 5, characterized in that, The controller is further configured to: After determining the character pattern corresponding to the writing track, a plurality of line segments of a preset length are added to the contour of the character pattern according to the slope between the current node and the previous node in the writing track.
7. A font generation method characterized by comprising: The method comprises: obtaining a writing track of a user, and determining a Bezier curve corresponding to the writing track according to each node in the writing track; obtaining a preset corresponding relationship between writing speed and width; and determining the transparency and width of a Bezier curve segment corresponding to adjacent nodes in the writing track according to the writing speed between the adjacent nodes in the writing track, respectively. If the current two adjacent nodes in the writing track are not the first two nodes in the writing track, the width Wc of a target Bezier curve segment corresponding to the current two adjacent nodes in the writing track is determined in the following manner: Wc=Wp+min(abs(k*s-Wp),d*w) wherein Wp represents the width of a previous Bezier curve segment adjacent to the target Bezier curve segment, k represents a preset proportionality coefficient between writing speed and width, s represents the writing speed between the current two adjacent nodes in the writing track, d represents the length of the target Bezier curve segment, and w represents a preset coefficient; determining a character pattern corresponding to the writing track according to the transparency and width of the Bezier curve segment corresponding to the adjacent nodes in the writing track.
8. The method of claim 7, wherein, The method comprises: obtaining a preset corresponding relationship between writing speed and transparency; and determining the transparency corresponding to the writing speed between the adjacent nodes in the writing track as the transparency of the Bezier curve segment corresponding to the adjacent nodes in the writing track according to the preset corresponding relationship between writing speed and transparency.
9. The method of claim 7, wherein, The method further comprises: After determining the character pattern corresponding to the writing track, a plurality of line segments of a preset length are added to the contour of the character pattern according to the slope between the current node and the previous node in the writing track.
Citation Information
Patent Citations
Handwriting display method and system, smart terminal and smart writing system
CN107481299A
Writing stroke implementation method and device, electronic equipment and readable storage medium
CN112905102A
Data classification method and apparatus, device and storage medium
US20240273118A1