question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

right-to-left language support

See original GitHub issue

Per https://github.com/capitalone/react-native-pathjs-charts/issues/181 it seems there is an issue with rendering right-to-left languages (at least on Android). Specifically in Persian, words are backwards and letters are not cursive-joined.

Here is an example that reproduces the issue:

import Svg,{ G, Path, Text } from 'react-native-svg'
...
render(){
    let persianText = "الفبای فارسی‎‎";
    return (
      <View>
        <Svg width={200} height={200}><G><Text>{persianText}</Text></G></Svg>
      </View>
    )
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:22
  • Comments:25

github_iconTop GitHub Comments

2reactions
msandcommented, Aug 26, 2019

Perhaps you can use the relatively recently implemented inlineSize attribute then:

import * as React from "react";
import { View, Text } from "react-native";
import { Svg, G, Text as SvgText, TSpan } from "react-native-svg";

let persianText = "الفبای فارسی‎‎";

export default () => (
  <View>
    <Text>{persianText}</Text>
    <Svg
      width="100%"
      height="100%"
      style={{ borderWidth: 1, borderColor: "black" }}
    >
      <SvgText>
        <TSpan y={15} fontSize={14} inlineSize="100%" textAnchor="start" >
          {persianText}
        </TSpan>
        <TSpan y={30} fontSize={14} inlineSize="100%" textAnchor="middle" >
          {persianText}
        </TSpan>
        <TSpan y={45} fontSize={14} inlineSize="100%" textAnchor="end" >
          {persianText}
        </TSpan>
      </SvgText>
    </Svg>
  </View>
);

Screenshot_1566845476

2reactions
BatDroidcommented, Aug 26, 2019

any one can tell what awebfont.ir/convert is exactly doing to the passed text. if we find out then we can find a util for it to do it for us to use it for dynamic data as well as static ones

Read more comments on GitHub >

github_iconTop Results From Across the Web

The twisted road through right-to-left language support
The twisted road through right-to-left language support ... and Hebrew, Arabic, Urdu (and some others) as RTL languages (Right-to-Left).
Read more >
Right-to-left language support and bidirectional text
A great example of right-to-left language support: Microsoft Word. In the area of right-to-left (RTL) language support, one consideration is the ...
Read more >
Right to left - Foundations - Human Interface Guidelines - Design
Support right-to-left languages like Arabic and Hebrew by reversing your interface as needed to match the reading direction of the related scripts.
Read more >
Checklist: Right-to-Left language (RTL)? - LingoHub
Checklist: Right-To-Left Languages (RTL) · Bidi Unicode support · Basic information about RTL languages · Which are Right-to-Left Languages?
Read more >
Right-to-left script - Wikipedia
Arabic, Hebrew, Persian, Pashto, Urdu, Kashmiri and Sindhi are the most widespread R2L writing systems in modern times. The Hebrew language is still...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found