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

Only use data-font-name attributes when necessary. #5193

Merged
merged 1 commit into from
Aug 18, 2014

Conversation

nnethercote
Copy link
Contributor

The data-font-name attribute of textLayer divs are only used by the Font
Inspector. This change omits them when Font Inspector is disabled.

@@ -173,8 +176,11 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() {
this.textContent = textContent;

var textItems = textContent.items;
var fontInspectorEnabled =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add this as the TextLayerBuilder object property to avoid re-evaluating this for each text item

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it will be nice to specify that as an option during TextLayerBuilder construction. Can you move this check to the page_view.js level, and save e.g. 'debugFont' option at TextLayerBuilder object property

@nnethercote
Copy link
Contributor Author

I think this is what you asked for.

@yurydelendik
Copy link
Contributor

yes, it is.

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_preview from @yurydelendik received. Current queue size: 0

Live output at: http://107.21.233.14:8877/254b596744a9a52/output.txt

@@ -46,6 +46,7 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() {
this.isViewerInPresentationMode = options.isViewerInPresentationMode;
this.textDivs = [];
this.findController = options.findController || null;
this.debugFonts = options.debugFonts;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have || null at the end of this line too?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.debugFonts = !!options.debugFonts;

@yurydelendik
Copy link
Contributor

Built version fails with ReferenceError: globalScope is not defined. We don't expose globalScope in release version. Let's simplify debugFonts to PDFJS.pdfBug check

@nnethercote
Copy link
Contributor Author

Built version fails with ReferenceError: globalScope is not defined.

How do failures like this manifest in the testing? E.g. it doesn't show up in the Travis CI test.

The data-font-name attribute of textLayer divs are only used by the Font
Inspector. This change ensures they are only present when the pdfBug
tools are enabled.
@nnethercote
Copy link
Contributor Author

I ended up removing the debugFonts property from the options. It didn't seem worthwhile given that the test is now much simpler, and debugFonts wouldn't be an accurate name any more.

@CodingFabian
Copy link
Contributor

i think that new test is fine. It like a if (debugEnabled()) check. If any kind of debuggers are used then the font data is added. There is no fine grained debug testing, which would make it even harder to maintain.
The main objective was to get rid of font names in dom when running in production mode.

@yurydelendik
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_preview from @yurydelendik received. Current queue size: 0

Live output at: http://107.21.233.14:8877/a22280c910e72d7/output.txt

yurydelendik added a commit that referenced this pull request Aug 18, 2014
Only use data-font-name attributes when necessary.
@yurydelendik yurydelendik merged commit 4ef7058 into mozilla:master Aug 18, 2014
@yurydelendik
Copy link
Contributor

Thank you for the patch

@nnethercote nnethercote deleted the data-font-name branch August 18, 2014 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants