如何在vfs_fonts.js中分配ttf字体文件?

时间:2017-01-14 05:46:20

标签: javascript jquery fonts pdfkit pdfmake

我正在尝试将自定义字体添加到vfs_fonts.js中,但我不明白需要在window.pdfMake对象的值字段中写入什么内容?

我的密钥为“MyFont.ttf”,我知道该值只不过是ttf文件。我的ttf是一个物理文件而不是一组字符。如何填写值字段?

 window.pdfMake = window.pdfMake || {}; window.pdfMake.vfs = {
      "Roboto-Italic.ttf": "AAEAAAASAQAABA",
      "Roboto-Medium.ttf": "AAEAAA",
      "MyFont.ttf":"???????????????????"
    }

谢谢

1 个答案:

答案 0 :(得分:0)

 CREATE OR REPLACE FUNCTION insert_CourseRun()
    RETURNS VOID AS
    $$
    DECLARE curr_sem integer;
    DECLARE curr_season semester_season_type;
    DECLARE curr_year smallint ;
    DECLARE numofexisting integer;
    BEGIN
        numofexisting := (SELECT COUNT(*) FROM public."courserun") + 1 ;
        curr_sem := (SELECT s.semester_id FROM "semester" as s WHERE s.semester_status = 'present');
        if (curr_sem % 2 = 0) then 
            curr_season = 'spring';
            curr_year = curr_sem /2;
        else
            curr_season = 'winter';
            curr_year = (curr_sem+1) /2;
        end if;

        INSERT INTO public."courserun"  
        SELECT c.course_code, numofexisting, 5, 5, 2, curr_sem, labcode_for_course(c.course_code)
        FROM "Course" as c
        WHERE c.typical_season= curr_season and c.typical_year = curr_year;
    END;
    $$
    LANGUAGE 'plpgsql' VOLATILE;