fix zalgo properly! remove ugly regexp hacks for detecting combining diacritics and instead set the right font ordering, as Arial combines nicely with Myriad Pro whilst Helvetica doesn't. (Myriad Pro itself has no combining diacritic characters)

This commit is contained in:
Matthew Hodgson 2015-11-30 01:13:59 +00:00
parent 9a64dc27fc
commit cd040ae0dd
10 changed files with 16 additions and 25 deletions

View file

@ -17,11 +17,6 @@ limitations under the License.
'use strict';
var React = require('react');
var classNames = require("classnames");
// The Lato WOFF doesn't include sensible combining diacritics, so Chrome chokes on rendering them.
// Revert to Arial when this happens, which on OSX works at least.
var zalgo = /[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/;
module.exports = React.createClass({
displayName: 'SenderProfile',
@ -30,18 +25,12 @@ module.exports = React.createClass({
var mxEvent = this.props.mxEvent;
var name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender();
var classes = classNames({
mx_SenderProfile: true,
// taken from https://en.wikipedia.org/wiki/Combining_character
mx_SenderProfile_zalgo: zalgo.test(name),
});
var msgtype = mxEvent.getContent().msgtype;
if (msgtype && msgtype == 'm.emote') {
name = ''; // emote message must include the name so don't duplicate it
}
return (
<span className={classes}>
<span className="mx_SenderProfile">
{name} { this.props.aux }
</span>
);