~ubuntu-branches/ubuntu/karmic/pango1.0/karmic-security

« back to all changes in this revision

Viewing changes to pango/fonts.c

  • Committer: Bazaar Package Importer
  • Author(s): Loic Minier
  • Date: 2007-12-18 21:11:37 UTC
  • mfrom: (1.2.44 upstream)
  • Revision ID: james.westby@ubuntu.com-20071218211137-0ibmwreimvxf3cp1
Tags: 1.19.2-1ubuntu1
* Sync with Debian; Ubuntu changes are:
  - Add patch 30_anymetrics, turns on FC_ANY_METRICS whenever looking up
    fonts with fontconfig; lets fontconfig's configuration know that we
    don't care about getting a font with exactly the same shape as the
    family we asked for and fixes (eg) a firefox vs. evince font metrics
    ugliness issue.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#include "pango-fontmap.h"
30
30
#include "pango-impl-utils.h"
31
31
 
32
 
static const char bad_font_warning[] = "%s called with null font argument, expect ugly output";
33
 
 
34
32
struct _PangoFontDescription
35
33
{
36
34
  char *family_name;
1314
1312
 * PANGO_DESCENT(), PANGO_LBEARING(), and PANGO_RBEARING() can be used to convert
1315
1313
 * from the extents rectangle to more traditional font metrics. The units
1316
1314
 * of the rectangles are in 1/PANGO_SCALE of a device unit.
 
1315
 *
 
1316
 * If @font is %NULL, this function gracefully sets some sane values in the
 
1317
 * output variables and returns.
1317
1318
 **/
1318
1319
void
1319
1320
pango_font_get_glyph_extents  (PangoFont      *font,
1323
1324
{
1324
1325
  if (G_UNLIKELY (!font))
1325
1326
    {
1326
 
 
1327
 
      if (!_pango_warning_history.get_glyph_extents)
1328
 
        {
1329
 
          _pango_warning_history.get_glyph_extents = TRUE;
1330
 
          g_warning (bad_font_warning, "pango_font_get_glyph_extents");
1331
 
        }
1332
1327
      if (ink_rect)
1333
1328
        {
1334
1329
          ink_rect->x = PANGO_SCALE;
1361
1356
 * be provided to indicate that the metrics should be retrieved that
1362
1357
 * correspond to the script(s) used by that language.
1363
1358
 *
 
1359
 * If @font is %NULL, this function gracefully sets some sane values in the
 
1360
 * output variables and returns.
 
1361
 *
1364
1362
 * Return value: a #PangoFontMetrics object. The caller must call pango_font_metrics_unref()
1365
1363
 *   when finished using the object.
1366
1364
 **/
1370
1368
{
1371
1369
  if (G_UNLIKELY (!font))
1372
1370
    {
1373
 
      PangoFontMetrics *metrics;
1374
 
 
1375
 
      if (!_pango_warning_history.get_metrics)
1376
 
        {
1377
 
          _pango_warning_history.get_metrics = TRUE;
1378
 
          g_warning (bad_font_warning, "pango_font_get_metrics");
1379
 
        }
1380
 
      metrics = pango_font_metrics_new ();
 
1371
      PangoFontMetrics *metrics = pango_font_metrics_new ();
1381
1372
 
1382
1373
      metrics->ascent = PANGO_SCALE * PANGO_UNKNOWN_GLYPH_HEIGHT;
1383
1374
      metrics->descent = 0;
1400
1391
 *
1401
1392
 * Gets the font map for which the font was created.
1402
1393
 *
1403
 
 * Return value: the #PangoFontMap for the font
 
1394
 * Return value: the #PangoFontMap for the font, or %NULL if @font is %NULL.
1404
1395
 *
1405
1396
 * Since: 1.10
1406
1397
 **/
1408
1399
pango_font_get_font_map (PangoFont *font)
1409
1400
{
1410
1401
  if (G_UNLIKELY (!font))
1411
 
    {
1412
 
 
1413
 
      if (!_pango_warning_history.get_font_map)
1414
 
        {
1415
 
          _pango_warning_history.get_font_map = TRUE;
1416
 
          g_warning (bad_font_warning, "pango_font_get_font_map");
1417
 
        }
1418
 
      return NULL;
1419
 
    }
 
1402
    return NULL;
1420
1403
 
1421
1404
  if (PANGO_FONT_GET_CLASS (font)->get_font_map)
1422
1405
    return PANGO_FONT_GET_CLASS (font)->get_font_map (font);