jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/390945 )

Change subject: Remove autonym font and its usage
......................................................................


Remove autonym font and its usage

I no longer maintain the Autonym font.
Also remove the tofu detection.

Bug: T135464
Bug: T135465
Change-Id: I103aab40ea5f5fc403a7ee5b23d1b634cc9c6ee1
---
M UniversalLanguageSelector.hooks.php
D data/fontrepo/fonts/Autonym/Autonym.ttf
D data/fontrepo/fonts/Autonym/Autonym.woff
D data/fontrepo/fonts/Autonym/Autonym.woff2
D data/fontrepo/fonts/Autonym/font.ini
M extension.json
M resources/js/ext.uls.webfonts.js
M resources/js/ext.uls.webfonts.repository.js
D tests/autonym.html
9 files changed, 9 insertions(+), 235 deletions(-)

Approvals:
  jenkins-bot: Verified
  Nikerabbit: Looks good to me, approved



diff --git a/UniversalLanguageSelector.hooks.php 
b/UniversalLanguageSelector.hooks.php
index 70135b4..3dc19ad 100644
--- a/UniversalLanguageSelector.hooks.php
+++ b/UniversalLanguageSelector.hooks.php
@@ -188,7 +188,7 @@
                        'uls' => [
                                'text' => Language::fetchLanguageName( 
$langCode ),
                                'href' => '#',
-                               'class' => 'uls-trigger autonym',
+                               'class' => 'uls-trigger',
                                'active' => true
                        ]
                ] + $personal_urls;
diff --git a/data/fontrepo/fonts/Autonym/Autonym.ttf 
b/data/fontrepo/fonts/Autonym/Autonym.ttf
deleted file mode 100644
index 0565206..0000000
--- a/data/fontrepo/fonts/Autonym/Autonym.ttf
+++ /dev/null
Binary files differ
diff --git a/data/fontrepo/fonts/Autonym/Autonym.woff 
b/data/fontrepo/fonts/Autonym/Autonym.woff
deleted file mode 100644
index 13b55d3..0000000
--- a/data/fontrepo/fonts/Autonym/Autonym.woff
+++ /dev/null
Binary files differ
diff --git a/data/fontrepo/fonts/Autonym/Autonym.woff2 
b/data/fontrepo/fonts/Autonym/Autonym.woff2
deleted file mode 100644
index 32b38ce..0000000
--- a/data/fontrepo/fonts/Autonym/Autonym.woff2
+++ /dev/null
Binary files differ
diff --git a/data/fontrepo/fonts/Autonym/font.ini 
b/data/fontrepo/fonts/Autonym/font.ini
deleted file mode 100644
index 14e9ee4..0000000
--- a/data/fontrepo/fonts/Autonym/font.ini
+++ /dev/null
@@ -1,6 +0,0 @@
-[Autonym]
-languages=mul
-version=20131205
-license=OFL-1.1
-licensefile=OFL.txt
-url=https://github.com/santhoshtr/AutonymFont/
diff --git a/extension.json b/extension.json
index d7afde5..4bdae52 100644
--- a/extension.json
+++ b/extension.json
@@ -257,7 +257,6 @@
                "ext.uls.webfonts.fonts": {
                        "dependencies": [
                                "jquery.webfonts",
-                               "jquery.uls.data",
                                "ext.uls.webfonts.repository"
                        ],
                        "localBasePath": "resources",
diff --git a/resources/js/ext.uls.webfonts.js b/resources/js/ext.uls.webfonts.js
index 0bf41b9..b536ee8 100644
--- a/resources/js/ext.uls.webfonts.js
+++ b/resources/js/ext.uls.webfonts.js
@@ -20,11 +20,7 @@
 ( function ( $, mw ) {
        'use strict';
 
-       var ulsPreferences,
-               // Text to prepend the sample text. 0D00 is an unassigned 
unicode point.
-               tofuSalt = '\u0D00',
-               // cache languages with tofu.
-               tofuLanguages = {};
+       var ulsPreferences;
 
        mw.webfonts = mw.webfonts || {};
        ulsPreferences = mw.uls.preferences();
@@ -67,62 +63,6 @@
                }
        };
 
-       /**
-        * Detect tofu
-        *
-        * Create a temporary span in the page with fontsize 72px and 
font-family
-        * sans-serif for each letter of the text.
-        * For each of these spans, calculate the width and height. If they are 
same
-        * for all spans, we can understand that each of the letter is rendered 
using
-        * same glyph - it must be a tofu.
-        *
-        * @param {string} text
-        * @return {boolean}
-        */
-       function detectTofu( text ) {
-               var index,
-                       $fixture,
-                       width = {},
-                       height = {},
-                       length = Math.min( 4, text.length ),
-                       detected = false;
-
-               if ( $.client.test( {
-                       msie: false
-               } ) ) {
-                       // IE shows a different tofu for unassigned code points!
-                       text = tofuSalt + text;
-               }
-               $fixture = $( '<span>' )
-                       .css( {
-                               fontSize: '72px',
-                               fontFamily: 'sans-serif'
-                       } )
-                       .appendTo( 'body' );
-
-               for ( index = 0; index < length; index++ ) {
-                       $fixture.text( text[ index ] );
-                       width[ index ] = $fixture.width() || width[ index - 1 ];
-                       height[ index ] = $fixture.height();
-
-                       if ( index > 0 &&
-                               ( width[ index ] !== width[ index - 1 ] ||
-                                       height[ index ] !== height[ index - 1 ] 
)
-                       ) {
-                               detected = false;
-                               break;
-                       }
-               }
-
-               $fixture.remove();
-
-               if ( index === length ) {
-                       detected = true;
-               }
-
-               return detected;
-       }
-
        mw.webfonts.setup = function () {
                // Initialize webfonts
                var mediawikiFontRepository = $.webfonts.repository;
@@ -143,7 +83,7 @@
                         * @return {string|null}
                         */
                        fontSelector: function ( repository, language, classes 
) {
-                               var font, autonym, defaultFont;
+                               var font, defaultFont;
 
                                if ( !language ) {
                                        return null;
@@ -152,40 +92,15 @@
                                defaultFont = repository.defaultFont( language 
);
 
                                if ( classes && $.inArray( 'autonym', classes ) 
>= 0 ) {
-                                       autonym = true;
+                                       // Do not load font for showing autonym.
+                                       return null;
                                }
 
                                // If the user has a font preference, apply it 
always.
-                               font = mw.webfonts.preferences.getFont( 
language );
-                               if ( !font || autonym ) {
-                                       // Is there any default font for this 
language?
-                                       if ( ( !defaultFont || defaultFont === 
'system' ) && !autonym ) {
-                                               return font;
-                                       }
-
-                                       // There is a default font for this 
language,
-                                       // but check whether the user sees tofu 
for it.
-                                       if ( tofuLanguages[ language ] === 
undefined ) {
-                                               tofuLanguages[ language ] = 
detectTofu( $.uls.data.getAutonym( language ) );
-
-                                               // Log the tofu detection only 
once per page per language
-                                               if ( tofuLanguages[ language ] 
) {
-                                                       mw.log( 'tofu detected 
for ' + language );
-                                                       mw.hook( 
'mw.uls.webfonts.tofudetected' ).fire( language );
-                                               }
-                                       }
-
-                                       if ( tofuLanguages[ language ] ) {
-                                               font = autonym ? 'Autonym' : 
defaultFont;
-                                       } else {
-                                               // No tofu and no font 
preference. Use system font.
-                                               font = 'system';
-                                       }
-                               }
-
-                               if ( font === 'system' ) {
+                               font = mw.webfonts.preferences.getFont( 
language ) || defaultFont;
+                               if ( !font || font === 'system' ) {
                                        // Avoid setting 'system' as a font in 
css
-                                       font = null;
+                                       return null;
                                }
 
                                return font;
@@ -213,14 +128,6 @@
                // property values set by stylesheets.
                setTimeout( function () {
                        $( 'body' ).webfonts();
-
-                       // Load the CSS required for the Autonym font. Note 
that this won't download the font.
-                       // Browsers are smart enough to delay it till some 
element with this font-family
-                       // becomes visible. For example: If there is a popup 
div with an element with class
-                       // 'autonym', without explicitly calling .webfonts() on 
it, Autonym font will not
-                       // be applied in general. But we ensure that the CSS is 
ready so that the font
-                       // will be applied automatically to such future 
elements.
-                       $( 'body' ).data( 'webfonts' ).load( 'Autonym' );
                }, 0 );
        };
 
diff --git a/resources/js/ext.uls.webfonts.repository.js 
b/resources/js/ext.uls.webfonts.repository.js
index ea5141c..b5fb37b 100644
--- a/resources/js/ext.uls.webfonts.repository.js
+++ b/resources/js/ext.uls.webfonts.repository.js
@@ -1,4 +1,4 @@
-// Do not edit! This file is generated from data/fontrepo by 
data/fontrepo/scripts/compile.php
+// Do not edit! This file is generated from data/fontrepo by 
scripts/compile-font-repo.php
 ( function ( $ ) {
        $.webfonts = $.webfonts || {};
        $.webfonts.repository = {
@@ -306,10 +306,6 @@
                "muk": [
                        "Jomolhari"
                ],
-               "mul": [
-                       "system",
-                       "Autonym"
-               ],
                "my": [
                        "TharLon",
                        "Myanmar3",
@@ -521,11 +517,6 @@
                        "ttf": "Artaxerxes/Artaxerxes.ttf?79a74",
                        "woff": "Artaxerxes/Artaxerxes.woff?c1ed7",
                        "woff2": "Artaxerxes/Artaxerxes.woff2?7a96e"
-               },
-               "Autonym": {
-                       "ttf": "Autonym/Autonym.ttf?d41f5",
-                       "woff": "Autonym/Autonym.woff?235d8",
-                       "woff2": "Autonym/Autonym.woff2?280d0"
                },
                "CharisSIL": {
                        "ttf": "CharisSIL/CharisSIL-R.ttf?20bec",
diff --git a/tests/autonym.html b/tests/autonym.html
deleted file mode 100644
index 48626b7..0000000
--- a/tests/autonym.html
+++ /dev/null
@@ -1,117 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-<meta charset="utf-8" />
-<title>Autonym font Example</title>
-<meta name="description" content="A test page for the Autonym font" />
-<script 
src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
-<script src="../lib/jquery.uls/src/jquery.uls.data.js"></script>
-<script src="../lib/jquery.uls/src/jquery.uls.data.utils.js"></script>
-<style>
-@font-face {
-       font-family: 'Autonym';
-       src: url('../data/fontrepo/fonts/Autonym/Autonym.eot');
-       src: local('Autonym'),
-               url('../data/fontrepo/fonts/Autonym/Autonym.woff') 
format('woff'),
-               url('../data/fontrepo/fonts/Autonym/Autonym.ttf') 
format('truetype');
-       font-style: normal;
-}
-
-table, th, td {
-       border: 1px solid #ddd;
-       border-collapse:collapse;
-       padding: 5px;
-}
-
-td.lang,
-td.index {
-       background-color: #ccc;
-}
-</style>
-</head>
-<body>
-<h1>Autonym Font</h1>
-<p>The following table in this page uses the <a 
href="https://github.com/santhoshtr/AutonymFont";>Autonym</a>
- font for displaying language names without font issues.</p>
-<p>Version: 20131118</p>
-<hr/>
-<div>
-<label for="font-selector">Select a font:</label>
-<select id="font-selector">
-       <option value="Autonym">Autonym</option>
-       <option value="sans-serif">sans-serif</option>
-       <option value="Autonym, sans-serif">Autonym, sans-serif</option>
-       <option value="sans-serif, Autonym">sans-serif, Autonym</option>
-       <option value="Verdana, Arial, Helvetica, Autonym, sans-serif">Verdana, 
Arial, Helvetica, Autonym, sans-serif</option>
-</select>
-<select id="size-selector">
-       <option value="8">Select size (px)</option>
-       <option value="8">8</option>
-       <option value="9">9</option>
-       <option value="10">10</option>
-       <option value="11">11</option>
-       <option value="12">12</option>
-       <option value="13">13</option>
-       <option value="14">14</option>
-       <option value="16">16</option>
-       <option value="20">20</option>
-       <option value="24">24</option>
-       <option value="30">30</option>
-       <option value="36">36</option>
-       <option value="48">48</option>
-</select>
-<table><tr></tr></table>
-<div>A dropdown example:
-<select class="dropdown autonym">
-</select>
-</div>
-<script>
-var index = 1,
-       $fontSelector = $( '#font-selector' ),
-       $sizeSelector = $( '#size-selector' );
-
-$fontSelector.change( function () {
-       $( '.autonym' ).css( 'font-family', $( this ).val() );
-});
-
-$sizeSelector.change( function () {
-       $( '.autonym' ).css( 'font-size', $( this ).val() + 'px' );
-});
-
-$.each( $.uls.data.languages, function( langCode ) {
-       var autonym = $.uls.data.getAutonym( langCode ),
-               dir = $.uls.data.getDir( langCode );
-
-       $( '.dropdown' ).append(
-               $( '<option>')
-                       .attr( {
-                               lang: langCode,
-                               dir: dir
-                       } )
-                       .text( autonym )
-       );
-
-       $( 'table' ).append(
-               $( '<tr>' ).append(
-                       $( '<td>' )
-                               .addClass( 'index' )
-                               .text( index++ ),
-                       $( '<td>' )
-                               .addClass( 'lang' )
-                               .text( langCode ),
-                       $( '<td>' )
-                               .addClass( 'name autonym' )
-                               .attr( {
-                                       lang: langCode,
-                                       dir: dir
-                               } )
-                               .text( autonym )
-               )
-       );
-} );
-
-// Apply the initial font
-$( '.autonym' ).css( 'font-family', $fontSelector.val() );
-</script>
-</div>
-</body>

-- 
To view, visit https://gerrit.wikimedia.org/r/390945
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I103aab40ea5f5fc403a7ee5b23d1b634cc9c6ee1
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com>
Gerrit-Reviewer: Nikerabbit <niklas.laxst...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to