<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ghostty.git/src/font/CodepointMap.zig, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/'/>
<entry>
<title>Tentative fix for unexpected `font-codepoint-map` behavior</title>
<updated>2024-10-19T06:51:08+00:00</updated>
<author>
<name>Charly Delay</name>
<email>0@0xcharly.com</email>
</author>
<published>2024-10-19T05:08:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=96b4ff39a6eb3cfd3d74d8d6dee640830d48c90b'/>
<id>96b4ff39a6eb3cfd3d74d8d6dee640830d48c90b</id>
<content type='text'>
In particular when configured to replace several ranges with multiple fonts.

Given the following `font-codepoint-map` config:

```
font-codepoint-map=U+0030-U+0039=Monaco       # 0-9
font-codepoint-map=U+0040=mononoki            # @
font-codepoint-map=U+0041-U+005a=Pixel Code   # A-Z
font-codepoint-map=U+0061-U+007a=Victor Mono  # a-z
```

I noticed a couple of unexpected behavior:

1. Codepoint ranges were assigned the wrong font
2. The declaration order had a direct impact on the font assignment
   (seemed to be rotating in some fashion)

If my understanding of the current implementation is correct, for a
given range index `n` in the `MultiArrayList` `CodepointMap.get(…)`
returns the font descriptor at index `len - n - 1`. In other words, it
returns the descriptor symmetrically opposite relative to the middle of
the list.

I've added a couple test cases that I would expect to pass if my
understanding of the expected behavior is correct, verified that they
were broken under the current behavior, and updated the implementation
of `CodepointMap.get(…)` accordingly.

My understanding of the original intent is to give priority to the
latest range match in the list (which is a use case already tested by
the `codepointmap` test, but which I believe happened to pass "by
accident"), so I opted for a reverse traversal of the codepoint list.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In particular when configured to replace several ranges with multiple fonts.

Given the following `font-codepoint-map` config:

```
font-codepoint-map=U+0030-U+0039=Monaco       # 0-9
font-codepoint-map=U+0040=mononoki            # @
font-codepoint-map=U+0041-U+005a=Pixel Code   # A-Z
font-codepoint-map=U+0061-U+007a=Victor Mono  # a-z
```

I noticed a couple of unexpected behavior:

1. Codepoint ranges were assigned the wrong font
2. The declaration order had a direct impact on the font assignment
   (seemed to be rotating in some fashion)

If my understanding of the current implementation is correct, for a
given range index `n` in the `MultiArrayList` `CodepointMap.get(…)`
returns the font descriptor at index `len - n - 1`. In other words, it
returns the descriptor symmetrically opposite relative to the middle of
the list.

I've added a couple test cases that I would expect to pass if my
understanding of the expected behavior is correct, verified that they
were broken under the current behavior, and updated the implementation
of `CodepointMap.get(…)` accordingly.

My understanding of the original intent is to give priority to the
latest range match in the list (which is a use case already tested by
the `codepointmap` test, but which I believe happened to pass "by
accident"), so I opted for a reverse traversal of the codepoint list.
</pre>
</div>
</content>
</entry>
<entry>
<title>font: CodepointMap supports clone</title>
<updated>2024-04-07T17:54:59+00:00</updated>
<author>
<name>Mitchell Hashimoto</name>
<email>mitchell.hashimoto@gmail.com</email>
</author>
<published>2024-04-07T17:54:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=21a648748dbc28282f7e0ea54292cebae6118c4b'/>
<id>21a648748dbc28282f7e0ea54292cebae6118c4b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>font: CodepointMap hashable, use for groupcacheset</title>
<updated>2024-04-05T16:29:40+00:00</updated>
<author>
<name>Mitchell Hashimoto</name>
<email>mitchell.hashimoto@gmail.com</email>
</author>
<published>2024-04-01T19:38:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=9d8da8fcc72f3894dc0fd5949d795e1246e941ef'/>
<id>9d8da8fcc72f3894dc0fd5949d795e1246e941ef</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>font: add CodepointMap with tests</title>
<updated>2023-09-24T18:22:57+00:00</updated>
<author>
<name>Mitchell Hashimoto</name>
<email>mitchell.hashimoto@gmail.com</email>
</author>
<published>2023-09-24T18:22:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=3915d9ee3a53428b1114ec02dd6aeb613b73c23e'/>
<id>3915d9ee3a53428b1114ec02dd6aeb613b73c23e</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>font: CodepointMap</title>
<updated>2023-09-24T18:10:20+00:00</updated>
<author>
<name>Mitchell Hashimoto</name>
<email>mitchell.hashimoto@gmail.com</email>
</author>
<published>2023-09-24T18:05:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=4e54c5389ec7e40875a2c0d33f305ec54bec4881'/>
<id>4e54c5389ec7e40875a2c0d33f305ec54bec4881</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
