Index: CHANGELOG
===================================================================
--- CHANGELOG	(wersja 5428)
+++ CHANGELOG	(kopia robocza)
@@ -1,6 +1,7 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Add option to set default font for HTML message (#1484137)
 - Fix handling of HTML form elements in messages (#1485137)
 - Fix regression in setting recipient to self when replying to a Sent message (#1487074)
 - Fix listing of folders in hidden namespaces (#1486796)
Index: config/main.inc.php.dist
===================================================================
--- config/main.inc.php.dist	(wersja 5425)
+++ config/main.inc.php.dist	(kopia robocza)
@@ -787,4 +787,9 @@
 // Skip alternative email addresses in autocompletion (show one address per contact)
 $rcmail_config['autocomplete_single'] = false;
 
+// Default font for composed HTML message.
+// Supported values: Andale Mono, Arial, Arial Black, Book Antiqua, Courier New,
+// Georgia, Helvetica, Impact, Tahoma, Terminal, Times New Roman, Trebuchet MS, Verdana
+$rcmail_config['default_font'] = '';
+
 // end of config file
Index: program/include/main.inc
===================================================================
--- program/include/main.inc	(wersja 5425)
+++ program/include/main.inc	(kopia robocza)
@@ -2379,3 +2379,27 @@
     $RCMAIL->output->set_env('autocomplete_min_length', $RCMAIL->config->get('autocomplete_min_length'));
     $RCMAIL->output->add_label('autocompletechars', 'autocompletemore');
 }
+
+function rcube_fontdefs($font = null)
+{
+  $fonts = array(
+    'Andale Mono'   => '"Andale Mono",Times,monospace',
+    'Arial'         => 'Arial,Helvetica,sans-serif',
+    'Arial Black'   => '"Arial Black","Avant Garde",sans-serif',
+    'Book Antiqua'  => '"Book Antiqua",Palatino,serif',
+    'Courier New'   => '"Courier New",Courier,monospace',
+    'Georgia'       => 'Georgia,Palatino,serif',
+    'Helvetica'     => 'Helvetica,Arial,sans-serif',
+    'Impact'        => 'Impact,Chicago,sans-serif',
+    'Tahoma'        => 'Tahoma,Arial,Helvetica,sans-serif',
+    'Terminal'      => 'Terminal,Monaco,monospace',
+    'Times New Roman' => '"Times New Roman",Times,serif',
+    'Trebuchet MS'  => '"Trebuchet MS",Geneva,sans-serif',
+    'Verdana'       => 'Verdana,Geneva,sans-serif',
+  );
+
+  if ($font)
+    return $fonts[$font];
+
+  return $fonts;
+}
Index: program/localization/pl_PL/labels.inc
===================================================================
--- program/localization/pl_PL/labels.inc	(wersja 5425)
+++ program/localization/pl_PL/labels.inc	(kopia robocza)
@@ -434,5 +434,6 @@
 $labels['timeformat'] = 'Format czasu';
 $labels['isdraft'] = 'To jest kopia robocza wiadomości.';
 $labels['autocompletesingle'] = 'Nie pokazuj alternatywnych adresów przy autouzupełnianiu';
+$labels['defaultfont'] = 'Czcionka wiadomości HTML';
 
 ?>
Index: program/localization/en_US/labels.inc
===================================================================
--- program/localization/en_US/labels.inc	(wersja 5425)
+++ program/localization/en_US/labels.inc	(kopia robocza)
@@ -408,6 +408,7 @@
 $labels['focusonnewmessage'] = 'Focus browser window on new message';
 $labels['checkallfolders'] = 'Check all folders for new messages';
 $labels['displaynext'] = 'After message delete/move display the next message';
+$labels['defaultfont'] = 'Default font of HTML message';
 $labels['mainoptions'] = 'Main Options';
 $labels['section'] = 'Section';
 $labels['maintenance'] = 'Maintenance';
Index: program/js/editor.js
===================================================================
--- program/js/editor.js	(wersja 5425)
+++ program/js/editor.js	(kopia robocza)
@@ -66,6 +66,9 @@
   var elem = rcube_find_object('_from'),
     fe = rcmail.env.compose_focus_elem;
 
+  if (rcmail.env.default_font)
+    $(tinyMCE.get(rcmail.env.composebody).getBody()).css('font-family', rcmail.env.default_font);
+
   if (elem && elem.type == 'select-one') {
     rcmail.change_identity(elem);
     // Focus previously focused element
Index: program/js/app.js
===================================================================
--- program/js/app.js	(wersja 5425)
+++ program/js/app.js	(kopia robocza)
@@ -3002,6 +3002,11 @@
       this.display_spellcheck_controls(false);
       this.plain2html($('#'+props.id).val(), props.id);
       tinyMCE.execCommand('mceAddControl', false, props.id);
+
+      if (this.env.default_font)
+        window.setTimeout(function() {
+          $(tinyMCE.get(props.id).getBody()).css('font-family', rcmail.env.default_font);
+        }, 500);
     }
     else {
       var thisMCE = tinyMCE.get(props.id), existingHtml;
Index: program/steps/settings/func.inc
===================================================================
--- program/steps/settings/func.inc	(wersja 5425)
+++ program/steps/settings/func.inc	(kopia robocza)
@@ -480,7 +480,6 @@
       'sig'        => array('name' => Q(rcube_label('signatureoptions'))),
     );
 
-    // Show checkbox for HTML Editor
     if (!isset($no_override['htmleditor'])) {
       $field_id = 'rcmfd_htmleditor';
       $select_htmleditor = new html_select(array('name' => '_htmleditor', 'id' => $field_id));
@@ -633,6 +632,25 @@
       );
     }
 
+    if (!isset($no_override['default_font'])) {
+      $field_id     = 'rcmfd_default_font';
+      $fonts        = rcube_fontdefs();
+      $default_font = $config['default_font'] ? $config['default_font'] : 'Verdana';
+
+      $select = '<select name="_default_font" id="'.$field_id.'">';
+      foreach ($fonts as $fname => $font)
+        $select .= '<option value="'.$fname.'"'
+          . ($fname == $default_font ? ' selected="selected"' : '')
+          . ' style=\'font-family: ' . $font . '\'>'
+          . Q($fname) . '</option>';
+      $select .= '</select>';
+
+      $blocks['main']['options']['default_font'] = array(
+        'title' => html::label($field_id, Q(rcube_label('defaultfont'))),
+        'content' => $select
+      );
+    }
+
     break;
 
 
Index: program/steps/settings/save_prefs.inc
===================================================================
--- program/steps/settings/save_prefs.inc	(wersja 5425)
+++ program/steps/settings/save_prefs.inc	(kopia robocza)
@@ -86,6 +86,7 @@
       'top_posting'        => !empty($_POST['_top_posting']),
       'strip_existing_sig' => isset($_POST['_strip_existing_sig']),
       'sig_above'          => !empty($_POST['_sig_above']) && !empty($_POST['_top_posting']),
+      'default_font'       => get_input_value('_default_font', RCUBE_INPUT_POST),
     );
 
   break;
Index: program/steps/mail/sendmail.inc
===================================================================
--- program/steps/mail/sendmail.inc	(wersja 5425)
+++ program/steps/mail/sendmail.inc	(kopia robocza)
@@ -397,6 +397,15 @@
 // fetch message body
 $message_body = get_input_value('_message', RCUBE_INPUT_POST, TRUE, $message_charset);
 
+if ($isHtml) {
+  $font   = rcube_fontdefs($RCMAIL->config->get('default_font', 'Verdana'));
+  $bstyle = $font && is_string($font) ? " style='font-family: $font'" : '';
+
+  // append doctype and html/body wrappers
+  $message_body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">' .
+    "\r\n<html><body$bstyle>\r\n" . $message_body;
+}
+
 if (!$savedraft) {
   if ($isHtml) {
     // remove signature's div ID
@@ -406,10 +415,6 @@
     $bstyle = 'padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px; width:100%';
     $message_body = preg_replace('/<blockquote>/',
       '<blockquote type="cite" style="'.$bstyle.'">', $message_body);
-
-    // append doctype and html/body wrappers
-    $message_body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">' .
-      "\r\n<html><body>\r\n" . $message_body;
   }
 
   // Check spelling before send
@@ -443,10 +448,12 @@
 
   if ($footer)
     $message_body .= "\r\n" . $footer;
-  if ($isHtml)
-    $message_body .= "\r\n</body></html>\r\n";
 }
 
+if ($isHtml) {
+  $message_body .= "\r\n</body></html>\r\n";
+}
+
 // set line length for body wrapping
 $LINE_LENGTH = $RCMAIL->config->get('line_length', 72);
 
Index: program/steps/mail/compose.inc
===================================================================
--- program/steps/mail/compose.inc	(wersja 5427)
+++ program/steps/mail/compose.inc	(kopia robocza)
@@ -134,6 +134,12 @@
 $OUTPUT->set_env('top_posting', $RCMAIL->config->get('top_posting', false));
 $OUTPUT->set_env('recipients_separator', trim($RCMAIL->config->get('recipients_separator', ',')));
 
+// default font for HTML editor
+$font = rcube_fontdefs($RCMAIL->config->get('default_font', 'Verdana'));
+if ($font && !is_array($font)) {
+  $OUTPUT->set_env('default_font', $font);
+}
+
 // get reference message and set compose mode
 if ($msg_uid = $_SESSION['compose']['param']['draft_uid']) {
   $RCMAIL->imap->set_mailbox($CONFIG['drafts_mbox']);
