jquery - Getting url of @font_face tag in CSS using javascript -
currently have lot of @font_face tags in css
@font-face{ font-family: garamond; src: url('eprintfonts/pcl_91545.ttf'); } @font-face{ font-family: cg times; src: url('eprintfonts/pcl_92500_cg.ttf'); } @font-face{ font-family: cg omega; src: url('eprintfonts/pcl_92506.ttf'); }
i'm applying these font face tags using font-family name other elements. how can access src portion of particular font javascript if i'm given particular element has font face applied it?
whilst both of comments question provide links show ways in can retrieve applied rules given element, cannot show asked in question.
i'm not sure there's way of doing you're asking using simple js. (probably poor) suggestion find parse css file, , find through that. it's worth noting however, it's valid have rule such as:
src: local('open sans bold'), local('opensans-bold'), url('fonts/opensans-bold.woff') format('woff');
whereby first search local installations of font , use url if user doesn't have them. reason type of thing more complicated, , i've advise rethink approach.
Comments
Post a Comment