- 
                Notifications
    You must be signed in to change notification settings 
- Fork 4.8k
Add fonts with different font-weights #3036
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
          
     Merged
      
      
    
  
     Merged
                    Changes from 4 commits
      Commits
    
    
            Show all changes
          
          
            18 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      5c6f8e4
              
                Add fonts with different font-weights #2920
              
              
                vbinithyanandamv 9aac019
              
                Handled Optional
              
              
                vbinithyanandamv 847e5af
              
                Undefined cases handled
              
              
                vbinithyanandamv 1c54cfb
              
                Test Fixed
              
              
                vbinithyanandamv d4accaf
              
                handled custom fontweight and added test cases
              
              
                vbinithyanandamv 9309552
              
                removed console
              
              
                vbinithyanandamv 6b6b00b
              
                ie fix
              
              
                vbinithyanandamv 37171b9
              
                Preetier added
              
              
                vbinithyanandamv 1b73948
              
                Merge branch 'master' of https://github.com/MrRio/jsPDF into font-weight
              
              
                vbinithyanandamv f760a2e
              
                Review changes added
              
              
                vbinithyanandamv d8ecb73
              
                Fontweight logic added in setfont
              
              
                vbinithyanandamv 5403236
              
                review Feedback updated
              
              
                vbinithyanandamv 60ed833
              
                prettier done.
              
              
                vbinithyanandamv c2f4cc1
              
                test case added for setfont
              
              
                vbinithyanandamv 18dc53e
              
                review feedback updated
              
              
                vbinithyanandamv 6b45c14
              
                Run preetier
              
              
                vbinithyanandamv 9b68061
              
                Re-run build
              
              
                vbinithyanandamv e88252d
              
                Merge branch 'master' into font-weight
              
              
                HackbrettXXX File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -4850,15 +4850,22 @@ function jsPDF(options) { | |
| * @param {string} postScriptName PDF specification full name for the font. | ||
| * @param {string} id PDF-document-instance-specific label assinged to the font. | ||
| * @param {string} fontStyle Style of the Font. | ||
| * @param {number || string} fontWeight Weight of the Font. | ||
| * @param {Object} encoding Encoding_name-to-Font_metrics_object mapping. | ||
| * @function | ||
| * @instance | ||
| * @memberof jsPDF# | ||
| * @name addFont | ||
| * @returns {string} fontId | ||
| */ | ||
| API.addFont = function(postScriptName, fontName, fontStyle, encoding) { | ||
| encoding = encoding || "Identity-H"; | ||
| API.addFont = function(postScriptName, fontName, fontStyle, fontWeight, encoding) { | ||
| encoding = encoding || "Identity-H" | ||
| if ((fontStyle == 'normal' && fontWeight === 'bold') || (fontStyle == 'bold' && fontWeight == 'normal')) { | ||
| throw new Error("Invalid Combination of fontweight and fontstyle"); | ||
| } | ||
| if (fontWeight && fontStyle !== fontWeight) { | ||
| fontStyle = fontWeight == 400 ? 'normal' : fontWeight == 700 ? 'bold' : fontStyle + ' ' + fontWeight; | ||
|          | ||
| } | ||
| return addFont.call(this, postScriptName, fontName, fontStyle, encoding); | ||
| }; | ||
|  | ||
|  | ||
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
number|string