Mercurial > pidgin
comparison src/gtkimhtml.c @ 2116:6402958c64c9
[gaim-migrate @ 2126]
woo. got this from gtkfontsel.c. how fun. it should work a lot better.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Fri, 03 Aug 2001 10:27:45 +0000 |
parents | 3ce77b547cf2 |
children | 66a84ff0445a |
comparison
equal
deleted
inserted
replaced
2115:3ce77b547cf2 | 2116:6402958c64c9 |
---|---|
1587 gboolean italics, | 1587 gboolean italics, |
1588 gint fontsize) | 1588 gint fontsize) |
1589 { | 1589 { |
1590 gchar buf [16 * 1024]; | 1590 gchar buf [16 * 1024]; |
1591 GdkFont *font = NULL; | 1591 GdkFont *font = NULL; |
1592 XFontStruct *xfs; | |
1592 static gchar **fontnames = NULL; | 1593 static gchar **fontnames = NULL; |
1593 gchar *choice = NULL; | 1594 gchar *choice = NULL; |
1594 gint size = fontsize ? font_sizes [MIN (fontsize, MAX_SIZE) - 1] : 120; | 1595 gint size = fontsize ? font_sizes [MIN (fontsize, MAX_SIZE) - 1] : 120; |
1595 gint i, j; | 1596 gint i, j; |
1596 | 1597 |
1627 if (imhtml->default_font) | 1628 if (imhtml->default_font) |
1628 return gdk_font_ref (imhtml->default_font); | 1629 return gdk_font_ref (imhtml->default_font); |
1629 return gdk_fontset_load ("-*-*-*-*-*-*-*-*-*-*-*-*-*-*,*"); | 1630 return gdk_fontset_load ("-*-*-*-*-*-*-*-*-*-*-*-*-*-*,*"); |
1630 } | 1631 } |
1631 | 1632 |
1632 g_snprintf (buf, sizeof (buf), "-*-%s-%s-%c-*-*-*-%d-*-*-*-*-iso8859-*,*", | 1633 g_snprintf (buf, sizeof (buf), "-*-%s-%s-%c-*-*-*-%d-*-*-*-*-iso8859-*", |
1633 choice, | 1634 choice, |
1634 bold ? "bold" : "medium", | 1635 bold ? "bold" : "medium", |
1635 italics ? 'i' : 'r', | 1636 italics ? 'i' : 'r', |
1636 size); | 1637 size); |
1637 font = gdk_fontset_load (buf); | 1638 font = gdk_font_load (buf); |
1638 | 1639 |
1639 if (!font) { | 1640 if (!font) { |
1640 g_snprintf (buf, sizeof (buf), "-*-%s-%s-%c-*-*-*-*-*-*-*-*-iso8859-*,*", | 1641 g_snprintf (buf, sizeof (buf), "-*-%s-%s-%c-*-*-*-*-*-*-*-*-iso8859-*", |
1641 choice, | 1642 choice, |
1642 bold ? "bold" : "medium", | 1643 bold ? "bold" : "medium", |
1643 italics ? 'i' : 'r'); | 1644 italics ? 'i' : 'r'); |
1644 font = gdk_fontset_load (buf); | 1645 font = gdk_font_load (buf); |
1645 } | 1646 } |
1646 | 1647 |
1647 if (!font) { | 1648 if (!font) { |
1648 g_snprintf (buf, sizeof (buf), "-*-%s-*-%c-*-*-*-*-*-*-*-*-iso8859-*,*", | 1649 g_snprintf (buf, sizeof (buf), "-*-%s-*-%c-*-*-*-*-*-*-*-*-iso8859-*", |
1649 choice, | 1650 choice, |
1650 italics ? 'i' : 'r'); | 1651 italics ? 'i' : 'r'); |
1651 font = gdk_fontset_load (buf); | 1652 font = gdk_font_load (buf); |
1652 } | 1653 } |
1653 | 1654 |
1654 if (!font) { | 1655 if (!font) { |
1655 g_snprintf (buf, sizeof (buf), "-*-%s-*-%c-*-*-*-*-*-*-*-*-iso8859-*,*", | 1656 g_snprintf (buf, sizeof (buf), "-*-%s-*-%c-*-*-*-*-*-*-*-*-iso8859-*", |
1656 choice, | 1657 choice, |
1657 italics ? 'o' : '*'); | 1658 italics ? 'o' : '*'); |
1658 font = gdk_fontset_load (buf); | 1659 font = gdk_font_load (buf); |
1659 } | 1660 } |
1660 | 1661 |
1661 if (!font && italics) { | 1662 if (!font && italics) { |
1662 g_snprintf (buf, sizeof (buf), "-*-%s-*-*-*-*-*-*-*-*-*-*-iso8859-*,*", | 1663 g_snprintf (buf, sizeof (buf), "-*-%s-*-*-*-*-*-*-*-*-*-*-iso8859-*", |
1663 choice); | 1664 choice); |
1664 font = gdk_fontset_load (buf); | 1665 font = gdk_font_load (buf); |
1665 } | 1666 } |
1666 | 1667 |
1667 if (!font) { | 1668 if (!font) { |
1668 g_snprintf (buf, sizeof (buf), "-*-%s-%s-%c-*-*-*-%d-*-*-*-*-*-*,*", | 1669 g_snprintf (buf, sizeof (buf), "-*-%s-%s-%c-*-*-*-%d-*-*-*-*-*-*", |
1669 choice, | 1670 choice, |
1670 bold ? "bold" : "medium", | 1671 bold ? "bold" : "medium", |
1671 italics ? 'i' : 'r', | 1672 italics ? 'i' : 'r', |
1672 size); | 1673 size); |
1673 font = gdk_fontset_load (buf); | 1674 font = gdk_font_load (buf); |
1674 } | 1675 } |
1675 | 1676 |
1676 if (!font) { | 1677 if (!font) { |
1677 g_snprintf (buf, sizeof (buf), "-*-%s-%s-%c-*-*-*-*-*-*-*-*-*-*,*", | 1678 g_snprintf (buf, sizeof (buf), "-*-%s-%s-%c-*-*-*-*-*-*-*-*-*-*", |
1678 choice, | 1679 choice, |
1679 bold ? "bold" : "medium", | 1680 bold ? "bold" : "medium", |
1680 italics ? 'i' : 'r'); | 1681 italics ? 'i' : 'r'); |
1681 font = gdk_fontset_load (buf); | 1682 font = gdk_font_load (buf); |
1682 } | 1683 } |
1683 | 1684 |
1684 if (!font) { | 1685 if (!font) { |
1685 g_snprintf (buf, sizeof (buf), "-*-%s-*-%c-*-*-*-*-*-*-*-*-*-*,*", | 1686 g_snprintf (buf, sizeof (buf), "-*-%s-*-%c-*-*-*-*-*-*-*-*-*-*", |
1686 choice, | 1687 choice, |
1687 italics ? 'i' : 'r'); | 1688 italics ? 'i' : 'r'); |
1688 font = gdk_fontset_load (buf); | 1689 font = gdk_font_load (buf); |
1689 } | 1690 } |
1690 | 1691 |
1691 if (!font) { | 1692 if (!font) { |
1692 g_snprintf (buf, sizeof (buf), "-*-%s-*-%c-*-*-*-*-*-*-*-*-*-*,*", | 1693 g_snprintf (buf, sizeof (buf), "-*-%s-*-%c-*-*-*-*-*-*-*-*-*-*", |
1693 choice, | 1694 choice, |
1694 italics ? 'o' : '*'); | 1695 italics ? 'o' : '*'); |
1695 font = gdk_fontset_load (buf); | 1696 font = gdk_font_load (buf); |
1696 } | 1697 } |
1697 | 1698 |
1698 if (!font && italics) { | 1699 if (!font && italics) { |
1699 g_snprintf (buf, sizeof (buf), "-*-%s-*-*-*-*-*-*-*-*-*-*-*-*,*", | 1700 g_snprintf (buf, sizeof (buf), "-*-%s-*-*-*-*-*-*-*-*-*-*-*-*", |
1700 choice); | 1701 choice); |
1701 font = gdk_fontset_load (buf); | 1702 font = gdk_font_load (buf); |
1702 } | 1703 } |
1703 | 1704 |
1704 g_free (choice); | 1705 g_free (choice); |
1705 | 1706 |
1706 if (!font && imhtml->default_font) | 1707 if (!font && imhtml->default_font) |
1707 return gdk_font_ref (imhtml->default_font); | 1708 return gdk_font_ref (imhtml->default_font); |
1708 | 1709 |
1710 xfs = font ? GDK_FONT_XFONT (font) : NULL; | |
1711 if (xfs && (xfs->min_byte1 != 0 || xfs->max_byte1 != 0)) { | |
1712 gchar *tmp_name; | |
1713 | |
1714 gdk_font_unref (font); | |
1715 tmp_name = g_strconcat (buf, ",*", NULL); | |
1716 font = gdk_fontset_load (tmp_name); | |
1717 g_free (tmp_name); | |
1718 } | |
1719 | |
1709 if (!font) | 1720 if (!font) |
1710 return gdk_fontset_load ("-*-*-*-*-*-*-*-*-*-*-*-*-*-*"); | 1721 return gdk_fontset_load ("-*-*-*-*-*-*-*-*-*-*-*-*-*-*,*"); |
1722 | |
1711 | 1723 |
1712 return font; | 1724 return font; |
1713 } | 1725 } |
1714 | 1726 |
1715 static void | 1727 static void |