将阿拉伯字母表生成为 SVG

Generate Arabic alphabet to SVG

我在 SVG 中创建了基于 ASCII 码的字母。每个字符在一个单独的文件中。这是用作绘图应用程序中的剪贴画。以下是我用来生成 SVG 的脚本示例:

cat <<EOF > f.svg
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   version="1.1"
   width="512"
   height="512"
   id="svg3834"
   inkscape:version="0.48.4 r9939"
   sodipodi:docname="Perspective1.svg">
  <g id="board">
EOF

mkdir letters

i=32
while [ $i -lt 400 ]; do
    let "i++"

   OUT=$( printf "letters/%03d.svg" $i)
   echo $OUT
   cat f.svg > $OUT
   cat <<EOF >> $OUT
  <text x="32" y="256" 
        font-family="Verdana" font-size="256" fill="red" >
EOF
   printf "&#%d;" $i >> $OUT
   cat <<EOF >> $OUT
  </text>
  </g>
</svg>
EOF
done

echo ""
echo " Now convert  $( cygpath -w `pwd`)/letters/*.svg on http://www.fileformat.info/convert/image/svg2raster.htm "
echo

ls letters

我怎样才能 same/similar 获得阿拉伯语 alphabetic/numbers?

您可以查找 Unicode 代码范围。从 Wikipedia,我得到:

  • 阿拉伯语 (0600-06FF)
  • 阿拉伯语增补 (0750-077F)
  • 阿拉伯语扩展-A (08A0-08FF)
  • 阿拉伯文表示形式-A (FB50-FDFF)
  • 阿拉伯文表示形式-B (FE70-FEFF)
  • 阿拉伯数学字母符号 (1EE00-1EEFF)
  • 鲁米数字符号 (10E60-10E7F)

如果需要,例如阿拉伯语 0600-06FF,请将循环更改为:

for ((i=0x600;i<=0x6FF;i++)); do

一切都应该正常,除了你的字体。好像Verdana只支持泛拉丁文,所以你最好把font-family="Verdana"改成font-family="Verdana,sans-serif"这样你就可以有一个很好的回退。

P.S。您当前对字形指标的处理可能与阿拉伯文字中较宽的字形不符。

P.P.S。由于 $i.

的范围,您使用 3 位小数命名的文件可能会被破坏