comparison libvo/font_load_ft.c @ 7139:dd1e21e775b6

- add freetype support for gui - fix some small bug
author pontscho
date Thu, 29 Aug 2002 17:16:34 +0000
parents 0dc9cb756b68
children b9ce54c7f30f
comparison
equal deleted inserted replaced
7138:8ab4d11353ae 7139:dd1e21e775b6
854 free(desc); 854 free(desc);
855 } 855 }
856 856
857 static int load_sub_face(char *name, FT_Face *face) 857 static int load_sub_face(char *name, FT_Face *face)
858 { 858 {
859 int err; 859 int err = -1;
860 860
861 if (name) { 861 if (name) err = FT_New_Face(library, name, 0, face);
862 err = FT_New_Face(library, name, 0, face);
863 } else {
864 err = 1;
865 }
866 862
867 if (err) { 863 if (err) {
868 err = FT_New_Face(library, get_path("subfont.ttf"), 0, face); 864 err = FT_New_Face(library, get_path("subfont.ttf"), 0, face);
869 if (err) { 865 if (err) {
870 err = FT_New_Face(library, DATADIR"/subfont.ttf", 0, face); 866 err = FT_New_Face(library, DATADIR"/subfont.ttf", 0, face);
871 if (err) { 867 if (err) {
872 mp_msg(MSGT_OSD, MSGL_ERR, "New_Face failed. Maybe the font path is wrong.\n"); 868 mp_msg(MSGT_OSD, MSGL_ERR, "New_Face failed. Maybe the font path is wrong.\nPlease supply the text font file (~/.mplayer/subfont.ttf).\n" );
873 mp_msg(MSGT_OSD, MSGL_ERR, "Please supply the text font file (~/.mplayer/subfont.ttf).\n");
874 return -1; 869 return -1;
875 } 870 }
876 } 871 }
877 } 872 }
878 return err; 873 return err;
879 } 874 }
880 875
881 static int load_osd_face(FT_Face *face) 876 static int load_osd_face(FT_Face *face)
882 { 877 {
883 int err; 878 if ( FT_New_Memory_Face(library, osd_font_pfb, sizeof(osd_font_pfb), 0, face) ) {
884
885 err = FT_New_Memory_Face(library, osd_font_pfb, sizeof(osd_font_pfb), 0, face);
886 if (err) {
887 mp_msg(MSGT_OSD, MSGL_ERR, "New_Memory_Face failed..\n"); 879 mp_msg(MSGT_OSD, MSGL_ERR, "New_Memory_Face failed..\n");
888 return -1; 880 return -1;
889 } 881 }
890 return 0; 882 return 0;
891 } 883 }
964 // t=GetTimer(); 956 // t=GetTimer();
965 957
966 /* generate the subtitle font */ 958 /* generate the subtitle font */
967 err = load_sub_face(fname, &face); 959 err = load_sub_face(fname, &face);
968 if (err) { 960 if (err) {
969 mp_msg(MSGT_OSD, MSGL_ERR, "subtitle font: load_sub_face failed.\n"); 961 mp_msg(MSGT_OSD, MSGL_WARN, "subtitle font: load_sub_face failed.\n");
970 goto gen_osd; 962 goto gen_osd;
971 } 963 }
972 964
973 #ifdef HAVE_FREETYPE21 965 #ifdef HAVE_FREETYPE21
974 if (unicode) { 966 if (unicode) {