element_fontface.erl 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. -module(element_fontface).
  2. -author('Konstantin Zakablukovsky').
  3. -include("svg.hrl").
  4. -compile(export_all).
  5. render_element(Record) ->
  6. wf_tags:emit_tag(<<"font-face">>, nitro:render(Record#font_face.body),
  7. lists:append([
  8. [
  9. {<<"id">>, Record#font_face.id},
  10. {<<"class">>, Record#font_face.class},
  11. {<<"style">>, Record#font_face.style},
  12. {<<"font-family">>, Record#font_face.font_family},
  13. {<<"font-style">>, Record#font_face.font_style},
  14. {<<"font-variant">>, Record#font_face.font_variant},
  15. {<<"font-weight">>, Record#font_face.font_weight},
  16. {<<"font-stretch">>, Record#font_face.font_stretch},
  17. {<<"font-size">>, Record#font_face.font_size},
  18. {<<"unicode-range">>, Record#font_face.unicode_range},
  19. {<<"units-per-em">>, Record#font_face.units_per_em},
  20. {<<"panose-1">>, Record#font_face.panose_1},
  21. {<<"stemv">>, Record#font_face.stemv},
  22. {<<"stemh">>, Record#font_face.stemh},
  23. {<<"slope">>, Record#font_face.slope},
  24. {<<"cap-height">>, Record#font_face.cap_height},
  25. {<<"x-height">>, Record#font_face.x_height},
  26. {<<"accent-height">>, Record#font_face.accent_height},
  27. {<<"ascent">>, Record#font_face.ascent},
  28. {<<"descent">>, Record#font_face.descent},
  29. {<<"widths">>, Record#font_face.widths},
  30. {<<"bbox">>, Record#font_face.bbox},
  31. {<<"ideographic">>, Record#font_face.ideographic},
  32. {<<"alphabetic">>, Record#font_face.alphabetic},
  33. {<<"mathematical">>, Record#font_face.mathematical},
  34. {<<"hanging">>, Record#font_face.hanging},
  35. {<<"v-ideographic">>, Record#font_face.v_ideographic},
  36. {<<"v-alphabetic">>, Record#font_face.v_alphabetic},
  37. {<<"v-mathematical">>, Record#font_face.v_mathematical},
  38. {<<"v-hanging">>, Record#font_face.v_hanging},
  39. {<<"underline-position">>, Record#font_face.underline_position},
  40. {<<"underline-thickness">>, Record#font_face.underline_thickness},
  41. {<<"strikethrough-position">>, Record#font_face.strikethrough_position},
  42. {<<"strikethrough-thickness">>, Record#font_face.strikethrough_thickness},
  43. {<<"overline-position">>, Record#font_face.overline_position},
  44. {<<"overline-thickness">>, Record#font_face.overline_thickness}
  45. ],
  46. svg_core(Record),
  47. Record#font_face.data_fields,
  48. Record#font_face.aria_states
  49. ])).
  50. %% Common SVG attributes
  51. svg_core(Record)-> [
  52. {<<"xml:base">>, Record#font_face.xmlbase},
  53. {<<"xml:lang">>, Record#font_face.xmllang},
  54. {<<"xml:space">>, Record#font_face.xmlspace}
  55. ].