# Typeface: give access to cmap table

**URL:** <https://forum.juce.com/t/typeface-give-access-to-cmap-table/35085>\
**Category:** Feature Requests\
**Created:** [September 5, 2019, 12:01am UTC](https://forum.juce.com/t/typeface-give-access-to-cmap-table/35085 "2019-09-05T00:01:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [September 5, 2019, 12:01am UTC](https://forum.juce.com/t/typeface-give-access-to-cmap-table/35085/1 "2019-09-05T00:01:34Z")

</div>

The otf font file has a table to lookup the glyph number for an UTF-8 code point.

Please make this information accessible, either by exposing the cmap, or preferably adding a function similar to this:

```auto
int Typeface::getGlyphNumberForCodePoint (int codePoint) const;

```

Additional information is in this [thread](https://forum.juce.com/t/typeface-glyphnumber-and-codepoint/35049).

---

<div class="post-metadata">

**Author:** ![jrlanglois](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jrlanglois/32/21372_2.png) [@jrlanglois](https://forum.juce.com/u/jrlanglois)\
**Post date:** [September 5, 2019, 1:31pm UTC](https://forum.juce.com/t/typeface-give-access-to-cmap-table/35085/2 "2019-09-05T13:31:00Z")

</div>

Funny, this reminds me of this massive discussion: [Complex Text Support](https://forum.juce.com/t/complex-text-support/6654)

---

<div class="post-metadata">

**Author:** ![jrlanglois](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jrlanglois/32/21372_2.png) [@jrlanglois](https://forum.juce.com/u/jrlanglois)\
**Post date:** [September 5, 2019, 1:34pm UTC](https://forum.juce.com/t/typeface-give-access-to-cmap-table/35085/3 "2019-09-05T13:34:04Z")

</div>

Some API research to help out:

- Win32: [`GetGlyphIndices`](https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-getglyphindicesa)
- DirectWrite: [`IDWriteFontFace::GetGlyphIndices`](https://docs.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontface-getglyphindices)

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [September 5, 2019, 10:23pm UTC](https://forum.juce.com/t/typeface-give-access-to-cmap-table/35085/4 "2019-09-05T22:23:52Z")

</div>

Thank you @jrlanglois, that saves me some research…  
But I do hope to avoid having to write platform dependent workarounds. I think the existing JUCE implementation should give that information. In fact, I believe could be already present in the platform dependent implementations, just needs to be made accessible through the JUCE API.
