| 1790 | |
| 1791 | |
| 1792 | public Font(PShapeSVG parent, XML properties) { |
| 1793 | super(parent, properties, false); |
| 1794 | // handle(parent, properties); |
| 1795 | |
| 1796 | XML[] elements = properties.getChildren(); |
| 1797 | |
| 1798 | horizAdvX = properties.getInt("horiz-adv-x", 0); |
| 1799 | |
| 1800 | namedGlyphs = new HashMap<>(); |
| 1801 | unicodeGlyphs = new HashMap<>(); |
| 1802 | glyphCount = 0; |
| 1803 | glyphs = new FontGlyph[elements.length]; |
| 1804 | |
| 1805 | for (int i = 0; i < elements.length; i++) { |
| 1806 | String name = elements[i].getName(); |
| 1807 | XML elem = elements[i]; |
| 1808 | if (name == null) { |
| 1809 | // skip it |
| 1810 | } else if (name.equals("glyph")) { |
| 1811 | FontGlyph fg = new FontGlyph(this, elem, this); |
| 1812 | if (fg.isLegit()) { |
| 1813 | if (fg.name != null) { |
| 1814 | namedGlyphs.put(fg.name, fg); |
| 1815 | } |
| 1816 | if (fg.unicode != 0) { |
| 1817 | unicodeGlyphs.put(Character.valueOf(fg.unicode), fg); |
| 1818 | } |
| 1819 | } |
| 1820 | glyphs[glyphCount++] = fg; |
| 1821 | |
| 1822 | } else if (name.equals("missing-glyph")) { |
| 1823 | // System.out.println("got missing glyph inside <font>"); |
| 1824 | missingGlyph = new FontGlyph(this, elem, this); |
| 1825 | } else if (name.equals("font-face")) { |
| 1826 | face = new FontFace(this, elem); |
| 1827 | } else { |
| 1828 | System.err.println("Ignoring " + name + " inside <font>"); |
| 1829 | } |
| 1830 | } |
| 1831 | } |
| 1832 | |
| 1833 | |
| 1834 | protected void drawShape() { |