Warning, /graphics/krita/3rdparty_vendor/raqm/0001-Add-arbitrary-run-break-function.patch is written in an unsupported language. File is not indexed.

0001 From 815a234b814565a7cfb01eb3f41404e295756d6a Mon Sep 17 00:00:00 2001
0002 From: =?UTF-8?q?Wolthera=20van=20H=C3=B6vell=20tot=20Westerflier?=
0003  <griffinvalley@gmail.com>
0004 Date: Tue, 25 Jul 2023 14:34:32 +0200
0005 Subject: [PATCH] Add arbitrary run break function.
0006 
0007 Sometimes we need the ability to arbitrarily break a run, particularly
0008 when the text layout has some custom text-positioning functionality,
0009 like for example SVG text chunks.
0010 ---
0011  src/raqm.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
0012  src/raqm.h |  2 ++
0013  2 files changed, 47 insertions(+)
0014 
0015 diff --git a/src/raqm.c b/src/raqm.c
0016 index 633c1f0..144c367 100644
0017 --- a/src/raqm.c
0018 +++ b/src/raqm.c
0019 @@ -174,6 +174,7 @@ typedef struct
0020    hb_language_t lang;
0021    hb_script_t   script;
0022    int           spacing_after;
0023 +  bool          arbitrary_break;
0024  } _raqm_text_info;
0025  
0026  typedef struct _raqm_run raqm_run_t;
0027 @@ -237,6 +238,7 @@ _raqm_init_text_info (raqm_t *rq)
0028      rq->text_info[i].lang = default_lang;
0029      rq->text_info[i].script = HB_SCRIPT_INVALID;
0030      rq->text_info[i].spacing_after = 0;
0031 +    rq->text_info[i].arbitrary_break = false;
0032    }
0033  }
0034  
0035 @@ -271,6 +273,9 @@ _raqm_compare_text_info (_raqm_text_info a,
0036  
0037    /* Spacing shouldn't break runs, so we don't compare them here. */
0038  
0039 +  if (b.arbitrary_break == true)
0040 +    return false;
0041 +  
0042    return true;
0043  }
0044  
0045 @@ -1257,6 +1262,46 @@ raqm_set_invisible_glyph (raqm_t *rq,
0046    return true;
0047  }
0048  
0049 +/**
0050 + * raqm_set_arbitrary_run_break:
0051 + * @rq: a #raqm_t.
0052 + * @index: index at which to initiate a run break.
0053 + * @break_run: whether to initiate a run break.
0054 + * 
0055 + * Sometimes runs should be split for arbitrary spec-related
0056 + * reasons, such as the SVG 1.1 text chunk concept.
0057 + * 
0058 + * Setting the arbitrary break to true will ensure that opentype
0059 + * features like ligatures are not formed across the boundary
0060 + * indicated by this break.
0061 + * 
0062 + * TODO: also have this break bidi-reordering runs.
0063 + * 
0064 + * Since: Replace Me
0065 + */
0066 +bool
0067 +raqm_set_arbitrary_run_break (raqm_t *rq,
0068 +                              size_t index,
0069 +                              bool break_run)
0070 +{
0071 +  if (!rq)
0072 +    return false;
0073 +  if (!rq->text_len)
0074 +    return true;
0075 +  
0076 +  index = _raqm_encoding_to_u32_index (rq, index);
0077 +  
0078 +  if (index >= rq->text_len)
0079 +    return false;
0080 +
0081 +  if (!rq->text_info)
0082 +    return false;
0083 +  
0084 +  rq->text_info[index].arbitrary_break = break_run;
0085 +  
0086 +  return true; 
0087 +}
0088 +
0089  static bool
0090  _raqm_itemize (raqm_t *rq);
0091  
0092 diff --git a/src/raqm.h b/src/raqm.h
0093 index 6fd6089..21cec4c 100644
0094 --- a/src/raqm.h
0095 +++ b/src/raqm.h
0096 @@ -173,6 +173,8 @@ RAQM_API bool
0097  raqm_set_invisible_glyph (raqm_t *rq,
0098                            int gid);
0099  
0100 +RAQM_API bool raqm_set_arbitrary_run_break(raqm_t* rq, size_t index, bool break_run);
0101 +
0102  RAQM_API bool
0103  raqm_layout (raqm_t *rq);
0104  
0105 -- 
0106 2.34.1
0107