Home > Backend Development > PHP Tutorial > javascript - How to generate stroked fonts and save them as pictures, using canvas or php?

javascript - How to generate stroked fonts and save them as pictures, using canvas or php?

WBOY
Release: 2016-08-04 09:21:58
Original
1432 people have browsed it

The size of the stroke can be set
javascript - How to generate stroked fonts and save them as pictures, using canvas or php?

  1. At present, the QR code is automatically generated in the background, and the text is also automatically generated. I have integrated it in the center of the picture using css

<code>代码结构如下:
<link href="print.css" rel="stylesheet"  media="print">
<div>
    <img src="" />
    <span class="font-border">我是描边字体</span>
</div>    </code>
Copy after login
Copy after login

The style of print.css is as follows:

<code>.font-border{
    text-shadow: 0 0 6px #fff,0 0 6px #fff,0 0 6px #fff,0 0 6px #fff,0 0 6px #fff,0 0 6px #fff,0 0 6px #fff,0 0 6px #fff,0 0 6px #fff,0 0 6px #fff,0 0 6px #fff,0 0 6px #fff,0 0 6px #fff,0 0 6px #fff;

}    </code>
Copy after login
Copy after login

The final style also has a stroke effect, but after clicking print, the stroke style disappears (Google Chrome version 52.0.2743.60 (64-bit))
Is it that printing does not support text-shadow?

2. Later I found http://www.liantu.com/ and found that they use canvas to integrate pictures and text.
But they encrypted it, and after decrypting it, it couldn’t be read. The variables were all single letters.
Can I use canvas to directly wrap the pictures and text elements I set above and their positions? Then I clicked download and downloaded the pictures directly to the local

3. Or is there any php plug-in that can be used to achieve strokes?

Reply content:

The size of the stroke can be set
javascript - How to generate stroked fonts and save them as pictures, using canvas or php?

  1. At present, the QR code is automatically generated in the background, and the text is also automatically generated. I have integrated it in the center of the picture using css

<code>代码结构如下:
<link href="print.css" rel="stylesheet"  media="print">
<div>
    <img src="" />
    <span class="font-border">我是描边字体</span>
</div>    </code>
Copy after login
Copy after login

The style of print.css is as follows:

<code>.font-border{
    text-shadow: 0 0 6px #fff,0 0 6px #fff,0 0 6px #fff,0 0 6px #fff,0 0 6px #fff,0 0 6px #fff,0 0 6px #fff,0 0 6px #fff,0 0 6px #fff,0 0 6px #fff,0 0 6px #fff,0 0 6px #fff,0 0 6px #fff,0 0 6px #fff;

}    </code>
Copy after login
Copy after login

The final style also has a stroke effect, but after clicking print, the stroke style disappears (Google Chrome version 52.0.2743.60 (64-bit))
Is it that printing does not support text-shadow?

2. Later I found http://www.liantu.com/ and found that they use canvas to integrate pictures and text.
But they encrypted it, and after decrypting it, it couldn’t be read. The variables were all single letters.
Can I use canvas to directly wrap the pictures and text elements I set above and their positions? Then I clicked download and downloaded the pictures directly to the local

3. Or is there any php plug-in that can be used to achieve strokes?

Draw pictures onto canvas, and the same goes for text. canvas supports text strokes.

Example:
https://jsfiddle.net/imys/yjhs8rz4/

php to generate font images, stroke fonts are related to font files

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template