summaryrefslogtreecommitdiff
path: root/pango/pango-line-private.h
blob: 963674c21f9b192b10c0e16ea83a8d5d4c538346 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
 * Copyright 2022 Red Hat, Inc.
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */

#pragma once

#include "pango-line.h"
#include "pango-break.h"
#include "pango-attributes.h"
#include "pango-glyph-item-private.h"


typedef struct _LineData LineData;
struct _LineData {
  char *text;
  int length;
  int n_chars;
  Pango2Direction direction;

  Pango2AttrList *attrs;
  Pango2LogAttr *log_attrs;
};

LineData *      line_data_new           (void);
LineData *      line_data_ref           (LineData *data);
void            line_data_unref         (LineData *data);
void            line_data_clear         (LineData *data);

struct _Pango2Line
{
  Pango2Context *context;
  LineData *data;

  int start_index;
  int length;
  int start_offset;
  int n_chars;
  GSList *runs;
  Pango2Run **run_array;
  int n_runs;

  guint wrapped             : 1;
  guint ellipsized          : 1;
  guint hyphenated          : 1;
  guint justified           : 1;
  guint starts_paragraph    : 1;
  guint ends_paragraph      : 1;
  guint has_extents         : 1;

  Pango2Direction direction;

  Pango2Rectangle ink_rect;
  Pango2Rectangle logical_rect;
};

Pango2Line * pango2_line_new               (Pango2Context       *context,
                                            LineData            *data);

void         pango2_line_ellipsize         (Pango2Line          *line,
                                            Pango2Context       *context,
                                            Pango2EllipsizeMode  ellipsize,
                                            int                  goal_width);

void         pango2_line_index_to_run      (Pango2Line          *line,
                                            int                  idx,
                                            Pango2Run          **run);

void         pango2_line_get_empty_extents (Pango2Line          *line,
                                            Pango2LeadingTrim    trim,
                                            Pango2Rectangle     *logical_rect);

void         pango2_line_check_invariants  (Pango2Line          *line);