Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect cursor position when writing in non-latin text (e.g. in Russian) #665

Closed
rutsky opened this issue Sep 23, 2015 · 11 comments · Fixed by #667
Closed

Incorrect cursor position when writing in non-latin text (e.g. in Russian) #665

rutsky opened this issue Sep 23, 2015 · 11 comments · Fixed by #667
Milestone

Comments

@rutsky
Copy link
Contributor

rutsky commented Sep 23, 2015

AFAIK Ace editor supports only monospace fonts and used in Swagger Editor Source Code Pro font doesn't have Cyrillic glyphs, so browser uses some other, non monospace, font.

Here is example of how it looks like if I type "ЩЩЩ":
selection_013

Notice cursor floating in the center of the letter.

Here is how it looks if I disable Source Code Pro font in Firefox style editor:

selection_014

@mohsen1
Copy link
Contributor

mohsen1 commented Sep 23, 2015

Are you on Windows? It's working fine for me on OS X.

screen shot 2015-09-23 at 9 54 05 am

One improvement that we can do on this is to add unicode-range to Source Code Pro font family in fonts.less file.

Source Code Pro has a wide range. I'm pretty sure Russian characters are in it. See Google Fonts entry and Source Code Pro repo

@rutsky
Copy link
Contributor Author

rutsky commented Sep 23, 2015

I'm on Ubuntu 14.04.

Cyrillic support in Source Code Pro was introduced recently, in July 2015.

Looking at https://github.com/swagger-api/swagger-editor/tree/master/app/fonts I can conclude that Swagger distributes own copy of Source Code Pro fonts, and last version of the fonts was updated 4 months ago, when no Cyrillic support was in the Source Code Pro font.

@rutsky
Copy link
Contributor Author

rutsky commented Sep 23, 2015

@mohsen1 I think you are lucky that fallback font for Source Code Pro on your system has monospace Cyrillic glyphs.

@mohsen1
Copy link
Contributor

mohsen1 commented Sep 23, 2015

I think that is the case. Can you run Swagger Editor locally and update the font file with latest from their GitHub repo and let me know the results? It would be nice if you make a pull request with that change.

@rutsky
Copy link
Contributor Author

rutsky commented Sep 23, 2015

I tested latest release of Source Code Pro fonts and cyrillic works there:

selection_017

I can provide pull request, but first, why do you embed fonts, why not to install them using Bower?
E.g.

bower install --save-dev git://github.com/adobe-fonts/source-code-pro.git#2.010R-ro/1.030R-it

@mohsen1
Copy link
Contributor

mohsen1 commented Sep 23, 2015

I would love to take out fonts from source code but not all of them are available in bower/github. If you can do it even partially I would appreciate it.

@rutsky
Copy link
Contributor Author

rutsky commented Sep 23, 2015

Source Code Pro is not published in Bower, instead they suggest to install directly from GitHub.

Source Code Pro's release branch doesn't have SVG version of fonts (which are not supported in major browsers anyway), but has WOFF2 version.

@mohsen1
Copy link
Contributor

mohsen1 commented Sep 23, 2015

Then lets keep having font files in the source code. It's more reliable and predictable.

@rutsky
Copy link
Contributor Author

rutsky commented Sep 23, 2015

Then lets keep having font files in the source code. It's more reliable and predictable.

I used specific git sha1 version in PR - this should be reliable and predictable, unless Adobe will decide to remove whole repository.

@mohsen1
Copy link
Contributor

mohsen1 commented Sep 23, 2015

ok, works for me. Does it install all variants(thicknesses)?

@rutsky
Copy link
Contributor Author

rutsky commented Sep 23, 2015

ok, works for me. Does it install all variants(thicknesses)?

I believe so.
Previously (according to fonts definitions in fonts.less) there was: "font-style: normal; font-weight: 300, 400, 500, 600;";
now (according to source-code-pro.css) there is additionally "font-weight: 200, 700, 900" and "italic" variants for all provided thicknesses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants