Arabic letter aren't showing (Roboto font family)

Hussein Najah8 months ago

Because you guys use "Roboto font" the Arabic characters aren't supported.

  1. The CDN has no font other than "Roboto".
  2. Can't change the font or add one because of the CDN.
  3. Can't host it locally in the public folder.

=> tried to do that and it didn't work, /fonts/Rubik/Regular. no luck.

Anton Tananaev8 months ago

You can change anything you want. The source code is open.

Hussein Najah8 months ago

I tried to use diff font like rubik but I get an 404 not found, even if I try to add it in the findFont func.

https://cdn.traccar.com/map/fonts/{fontstack}/{range}.pbf

it's would say that

ajax.ts:161 
        
        GET https://fonts.openmaptiles.org/Rubik%20Regular/0-255.pbf 404 (Not Found)

Find Font Func

export const findFonts = (map) => {
  const fontSet = new Set();
  const { layers } = map.getStyle();
  layers?.forEach?.((layer) => {
    layer.layout?.["text-font"]?.forEach?.(fontSet.add, fontSet);
  });
  const availableFonts = [...fontSet];
  const regularFont = availableFonts.find((it) => it.includes("Regular"));
  if (regularFont) {
    return [regularFont];
  }
  const anyFont = availableFonts.find(Boolean);
  if (anyFont) {
    return [anyFont];
  }
  return ["Rubik Regular"];
};
Hussein Najah8 months ago

for some reason I can't edit,
this is what it's saying when I use Rubik font instead of Roboto in the findFont func.

ajax.ts:161 
        
        GET https://fonts.openmaptiles.org/Rubik%20Regular/0-255.pbf 404 (Not Found)
Anton Tananaev8 months ago

Well, the URL is returning 404, which means it doesn't exist.

Hussein Najah8 months ago

Well, I know it doesn't exist.

any other work around? tip? or anything?

Anton Tananaev8 months ago

If you know what the error means, your previous statement makes no sense at all. Why say that you can't edit when you know you can edit and that's just the URL you're trying to doesn't exist.

Hussein Najah8 months ago

no mate, by

for some reason I can't edit,

I meant the post not the code.

It doesn't exist. for that font, I want to use that support Arabic.
so may u please tell led me to the answer, all effort is appreciated.

I could do a pull req if I managed to fix the bug, so everyone can use it.
Again thank you.

Anton Tananaev8 months ago

Still. Your original comment says you can't change something because of CDN. You can clearly change the URL, so this has nothing to do with CDN or being able to change something. The issue is clearly just finding the font and linking to it.

Hussein Najah8 months ago

hmmm, well I can't find a url that have a Rubik font and when I do it locally it's just doesn't work!

Hussein Najah8 months ago

how can I upload font to the traccar cdn?
or how can I use something like this:

mapbox://fonts/mapbox/{fontstack}/{range}.pbf
Anton Tananaev8 months ago

You can send a pull request.

Hussein Najah8 months ago

pull request for what exactly?

let me break it down:
//useMapStyles.js
line 20
glyphs: 'https://cdn.traccar.com/map/fonts/{fontstack}/{range}.pbf',
in this line I can't change it to be like this,
glyphs: "mapbox://fonts/mapbox/{fontstack}/{range}.pbf"

the console.log
Fetch API cannot load mapbox://fonts/mapbox/Rubik Regular/0-255.pbf. URL scheme "mapbox" is not supported.
and I don't know what to do exactly.

so? idk

Hussein Najah8 months ago

and if u mean to add font to the traccar cdn by a pull req idk what I need to change exactly so the font would work

Anton Tananaev8 months ago

It sounds like the problem is again not what you said. I sounds like the problem is that you don't know how to get files from mapbox, not how to update the CDN.