いくつかのカスタム フォント (css のフォント フェイスを介して埋め込まれた) を含む svg を指定しました。ブラウザーでは正常に動作しますが、SVG から base64 でエンコードされた画像を作成しようとすると、フォントが認識されません。
Gere は私のコードです:
CSS
svg,text, textPath{
font-family: 'MyFont';
}
@font-face
{
font-family: MyFont;
src: src: url(data:application/x-font-ttf;base64,AAEAAAAQA...);
}
RaphaelJSを使用しているJS im
//set the text's font
t.attr({"font-family": "MyFont"})
//make the snapshot
var source = new Image();
$("body").append(source);
$('body').click(function(){
// record start time
var startTime = new Date();
var svg = $('#paper').html();
var mySrc = 'data:image/svg+xml;base64,'+Base64.encode(svg);
//source.src = base64Path + "?" + mySrc.slice(5);
source.src = mySrc;
var endTime = new Date();
console.log(endTime - startTime);
});