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

Support configure font style in scene #179

Open
syt123450 opened this issue Jan 10, 2019 · 6 comments
Open

Support configure font style in scene #179

syt123450 opened this issue Jan 10, 2019 · 6 comments
Assignees

Comments

@syt123450
Copy link
Member

syt123450 commented Jan 10, 2019

TensorSpace use fonts/helvetiker_regular.typeface.json as the basic font style for output1d layer text information. However, it does not support some text, for example, when input 中文, the fonts/helvetiker_regular.typeface.json will show ?? (this case can be reproduced in three.js docs's playground).

To handle this case, add a configuration in model, user can override the default fonts/helvetiker_regular.typeface.json with own fonts.

For example:

// user loadFont file through AJAX
let ownFont = loadFont();
let model = new TSP.models.Sequential({
    ...
    font: ownFont,
    ...
});
@Truemedia
Copy link

@syt123450 So I did a bit of digging on this after setting up a local instance of tensor (fixed a bug with missing dep aswell). I found the hard coded font and saw that there is an npm module for this specific font already (https://www.npmjs.com/package/three.regular.helvetiker). The rollup config didn't have common module and ES6 external resolver support so I added that into the build aswell. That at least trims down that giant line of json into one easy import. Still looking at the best way to pass through the option without rewriting too much function calls, but looks doable.

@syt123450
Copy link
Member Author

@Truemedia It's really a good news! I think this refactoring will highly improve the TensorSpace's source code readability. Could you send a PR related your refactoring?

@syt123450
Copy link
Member Author

@BoTime Could you give some suggestions about rollup configuration?

@Truemedia
Copy link

@syt123450 Sure, would you be able to open a feature branch/develop branch for me to do a new request on so it doesn't go into master just yet.

@syt123450 syt123450 assigned syt123450 and unassigned syt123450 Jan 29, 2019
@syt123450
Copy link
Member Author

Hi @Truemedia , I created a new issue #192 and create a new branch refactorfont. We can work under the new issue for refactoring, separate the work of refactor and new feature ~

@Truemedia
Copy link

@syt123450 Ok cool, I won't have much time to commit any code during week but weekend can probably box off both those branches with the new features

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

No branches or pull requests

2 participants