(XML properties)
| 1607 | // static private float TEXT_QUALITY = 1; |
| 1608 | |
| 1609 | static private PFont parseFont(XML properties) { |
| 1610 | String fontFamily = null; |
| 1611 | float size = 10; |
| 1612 | int weight = PLAIN; // 0 |
| 1613 | int italic = 0; |
| 1614 | |
| 1615 | if (properties.hasAttribute("style")) { |
| 1616 | String styleText = properties.getString("style"); |
| 1617 | String[] styleTokens = PApplet.splitTokens(styleText, ";"); |
| 1618 | |
| 1619 | //PApplet.println(styleTokens); |
| 1620 | for (int i = 0; i < styleTokens.length; i++) { |
| 1621 | String[] tokens = PApplet.splitTokens(styleTokens[i], ":"); |
| 1622 | //PApplet.println(tokens); |
| 1623 | |
| 1624 | tokens[0] = PApplet.trim(tokens[0]); |
| 1625 | |
| 1626 | if (tokens[0].equals("font-style")) { |
| 1627 | // PApplet.println("font-style: " + tokens[1]); |
| 1628 | if (tokens[1].contains("italic")) { |
| 1629 | italic = ITALIC; |
| 1630 | } |
| 1631 | } else if (tokens[0].equals("font-variant")) { |
| 1632 | // PApplet.println("font-variant: " + tokens[1]); |
| 1633 | // setFillOpacity(tokens[1]); |
| 1634 | |
| 1635 | } else if (tokens[0].equals("font-weight")) { |
| 1636 | // PApplet.println("font-weight: " + tokens[1]); |
| 1637 | |
| 1638 | if (tokens[1].contains("bold")) { |
| 1639 | weight = BOLD; |
| 1640 | // PApplet.println("Bold weight ! "); |
| 1641 | } |
| 1642 | |
| 1643 | |
| 1644 | } else if (tokens[0].equals("font-stretch")) { |
| 1645 | // not supported. |
| 1646 | |
| 1647 | } else if (tokens[0].equals("font-size")) { |
| 1648 | // PApplet.println("font-size: " + tokens[1]); |
| 1649 | size = Float.parseFloat(tokens[1].split("px")[0]); |
| 1650 | // PApplet.println("font-size-parsed: " + size); |
| 1651 | } else if (tokens[0].equals("line-height")) { |
| 1652 | // not supported |
| 1653 | |
| 1654 | } else if (tokens[0].equals("font-family")) { |
| 1655 | // PApplet.println("Font-family: " + tokens[1]); |
| 1656 | fontFamily = tokens[1]; |
| 1657 | |
| 1658 | } else if (tokens[0].equals("text-align")) { |
| 1659 | // not supported |
| 1660 | |
| 1661 | } else if (tokens[0].equals("letter-spacing")) { |
| 1662 | // not supported |
| 1663 | |
| 1664 | } else if (tokens[0].equals("word-spacing")) { |
| 1665 | // not supported |
| 1666 |
no test coverage detected